prototypes required ?

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Oct 19 02:48:04 AEST 1990


In article <1964 at ccadfa.adfa.oz.au> Christopher-Vance at adfa.oz.au writes:
>gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
>| Yes, you definitely must have a prototype in scope before calling a
>| variable-argument function in a strictly conforming program.
>Which means that gcc -ansi on a Pyramid cannot compile such a thing. I am
>informed that the only way to make printf work is to *omit* the prototype.

As I said before, you should rely on <stdio.h> to properly declare printf().
If <stdio.h> is not included at all, then the C standard guarantees that you
could declare printf() directly in your program, providing that you use the
prototype specified in the standard.  "extern int printf();" on the other
hand has undefined behavior.



More information about the Comp.std.c mailing list