Weird BC++ 3.1 warnings

Weird BC++ 3.1 warnings

Post by Youren G » Sat, 18 Jul 1992 06:10:06



When I use BC++ 3.1 to compile some of my programs which were compiled with
BC++ 3.0 without any warning meesages, I got a lot of weird messages of
the same type "Call to function 'xxx' with no prototypes". I did include
all the function prototypes. If you doubt it, try to compile the following
test program. I understand you can disable this warning message, but it's
so annoying. Any ideas what's wrog here? Thanks!

--Youren Guo
--------------------------------------------------------------------------
#include <stdio.h>

int ok();

int main ()
{
  if ( ok() )  /* ==> Warning: Call to function 'ok' with no prototype */
     printf ("******\n");
  return 0;

Quote:}

int ok()
{
   return 1;
Quote:}

-----------------------------------------------------------------------------

--
Youren Guo              University of Illinois at Urbana-Champaign

 
 
 

Weird BC++ 3.1 warnings

Post by Steve Resni » Sat, 18 Jul 1992 23:54:57



Quote:>When I use BC++ 3.1 to compile some of my programs which were compiled with
>BC++ 3.0 without any warning meesages, I got a lot of weird messages of
>the same type "Call to function 'xxx' with no prototypes". I did include
>all the function prototypes. If you doubt it, try to compile the following
>test program. I understand you can disable this warning message, but it's
>so annoying. Any ideas what's wrog here? Thanks!

>--Youren Guo
>--------------------------------------------------------------------------
>#include <stdio.h>

>int ok();

This is NOT a function prototype. It's a function declaration declaring that
ok() returns an int. What keeps the declaration from being a prototype is
that there is no declared parameter list.

To make this a function prototype, the prototype would be:
int ok(void);

>int main ()
>{
>  if ( ok() )  /* ==> Warning: Call to function 'ok' with no prototype */
>     printf ("******\n");
>  return 0;
>}

>int ok()
>{
>   return 1;
>}
>-----------------------------------------------------------------------------

>--
>Youren Guo          University of Illinois at Urbana-Champaign


Cheers
Steve

--
------------------------------------------------------------------------------

"I just want to be the one you run to, I just want to be the one you come to.
I just want to be there for someone, when the night comes" - J.*er
-----------------------------------------------------------------------------

 
 
 

Weird BC++ 3.1 warnings

Post by Matt Tell » Sat, 18 Jul 1992 23:32:35



Quote:>When I use BC++ 3.1 to compile some of my programs which were compiled with
>BC++ 3.0 without any warning meesages, I got a lot of weird messages of
>the same type "Call to function 'xxx' with no prototypes". I did include
>all the function prototypes. If you doubt it, try to compile the following
>test program. I understand you can disable this warning message, but it's
>so annoying. Any ideas what's wrog here? Thanks!

>--Youren Guo
>--------------------------------------------------------------------------
>#include <stdio.h>

>int ok();

>int main ()
>{
>  if ( ok() )  /* ==> Warning: Call to function 'ok' with no prototype */
>     printf ("******\n");
>  return 0;
>}

>int ok()
>{
>   return 1;
>}

int ok();  is *NOT* an ANSI prototype.  It is a K&R definition of the return
value of a function.   Try:

int ok(void);

Yes, it's dumb.

Matt

--
==============================================================================

                                 {...}ncar!ico!auto-trol!mattel
Auto-trol Technology 12500 N Washington Denver, CO 80241-2404 (303)252-2874

 
 
 

Weird BC++ 3.1 warnings

Post by Marko Kohta » Sat, 18 Jul 1992 23:45:50



Quote:>When I use BC++ 3.1 to compile some of my programs which were compiled with
>BC++ 3.0 without any warning meesages, I got a lot of weird messages of
>the same type "Call to function 'xxx' with no prototypes".
...
>int ok();
...
>  if ( ok() )  /* ==> Warning: Call to function 'ok' with no prototype */

You must have had a different configuration when you run 3.0. It gives
the same warning when the warning is enabled.

The reason for the warning is that you have not declared parameters
for the function, only the return type. If the function has no
parameters, then the parameter type must be 'void':

        int ok(void);

This is the ANSI convention.
--
---

Student at (not representative of) the Helsinki University of Technology

 
 
 

Weird BC++ 3.1 warnings

Post by Ralf.Br.. » Sat, 18 Jul 1992 21:14:26



Quote:}BC++ 3.0 without any warning meesages, I got a lot of weird messages of
}the same type "Call to function 'xxx' with no prototypes". I did include
}all the function prototypes. If you doubt it, try to compile the following
}
}int ok();

This is not an ANSI C prototype.  It's a K&R declaration, which does not
specify the arguments to the function.  The ANSI prototype for a
function with no arguments is

          int ok(void);

If you were to use C++ mode, then int ok() would be a valid prototype
for a function with no arguments--one of the few incompatibilities
between ANSI C and C++.

--

FIDO: Ralf Brown 1:129/26.1  |"Wisdom is the quality that keeps you from

AT&Tnet: (412)268-3053 school|              -- Doug Larson

 
 
 

Weird BC++ 3.1 warnings

Post by D'Arcy J.M. Ca » Sun, 19 Jul 1992 23:42:28



Quote:>When I use BC++ 3.1 to compile some of my programs which were compiled with
>BC++ 3.0 without any warning meesages, I got a lot of weird messages of
>the same type "Call to function 'xxx' with no prototypes". I did include
>all the function prototypes. If you doubt it, try to compile the following
> [...]
>int ok();

This is a declaration, not a prototype.  A prototype is a declaration
like the following:

int ok(void);

Note that although you are using BC++ you are probably using it in ANSI
or K&R mode since C++ treats an empty parameter list as if it was a void
list.  Either that or Borland got this wrong.  In any case it is best to
be specific about void parameter lists if only from a stylistic viewpoint.

--

D'Arcy Cain Consulting             |   There's no government
Toronto, Ontario, Canada           |   like no government!
+1 416 424 2871          DoD#0082  |

 
 
 

Weird BC++ 3.1 warnings

Post by Patrick Tayl » Tue, 04 Aug 1992 07:45:28



>Newsgroups: comp.os.msdos.programmer
>Path: exucom.exu.ericsson.se!ericom!sunic!mcsun!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!ygg6647

>Subject: Weird BC++ 3.1 warnings


>Organization: University of Illinois at Urbana
>Date: Thu, 16 Jul 1992 21:10:06 GMT
>Keywords: BC++
>Lines: 30
>When I use BC++ 3.1 to compile some of my programs which were compiled with
>BC++ 3.0 without any warning meesages, I got a lot of weird messages of
>the same type "Call to function 'xxx' with no prototypes". I did include
>all the function prototypes. If you doubt it, try to compile the following
>test program. I understand you can disable this warning message, but it's
>so annoying. Any ideas what's wrog here? Thanks!
>--Youren Guo
>--------------------------------------------------------------------------
>#include <stdio.h>
>int ok();

^^^^^^^^^^^^^^^^^
This is not a proper prototype.   Try:

int ok(void);

>int main ()
>{
>  if ( ok() )  /* ==> Warning: Call to function 'ok' with no prototype */
>     printf ("******\n");
>  return 0;
>}
>int ok()
>{
>   return 1;
>}
>-----------------------------------------------------------------------------
>--
>Youren Guo              University of Illinois at Urbana-Champaign


                                                                                        "This must be Thursday.  I never could get the hang of Thursdays"                                                                     - D Adams
  - Patrick Taylor

 
 
 

1. BC++ 3.1 Linker Warning (Duplicate WinMain)

  When I link my Windows program under BC++ 3.1 with the "warn
duplicate symbols" linker option on, I am receiving the following
warning message...

Linker Warning:WINMAIN defined in module xxx.cpp is duplicated in module WINMAIN.

The map file shows the message...

Warning: WINMAIN defined in module xxx.cpp is duplicated in library file CWS.LIB in module WINMAIN,

but shows only one definition of WINMAIN in the symbol table.  The
only #include in this program is windows.h, plus whatever run time
stuff is linked in by default.

  I notice that if I turn the "warn duplicate symbols option on" I
will see this message even for Borland's example programs.  What is
the cause of this warning, and is it a problem (the program seems to
run just fine)?  How can I eliminate it (we're kind of strict on
having no warnings for released software)?

Paul

----------------------------------------------------------------------

| Odetics Inc., Broadcast Division |         uunet!odetics.com!paulh |
| 1515 S. Manchester Ave.          | phone:  (714) 774-2200 ext 3793 |
| Anaheim, CA, USA  92802-2907     | fax:    (714) 535-8532          |
----------------------------------------------------------------------
| Disclaimer:  Odetics is not responsible for anything I say or do!  |
----------------------------------------------------------------------

2. Research Director: Health Policy and Human Factors

3. WARNING !!!!! MS WINDOWS 3.1 SmartDrive Problem

4. problem with IIcx 1.44mb drives

5. BC++3.1 vs. BC++4.x poll?

6. HDTV Sync from RE2

7. grx22 and BC 3.1

8. Maple crashes Excel

9. BC++ 3.0 vs 3.1 bug fixed?

10. Turbo Vision 1.0 and BC++ 3.1

11. Problem w/ BC++ 3.1 and Pentium-120? -Reply

12. I need Ctrl-Ins in BC 3.1 again

13. Cannot access kbCtrlIns (BC++ 3.1)