<varargs.h> vs. function prototypes

Doug Gwyn gwyn at smoke.brl.mil
Fri Jun 14 02:56:49 AEST 1991


In article <25353 at oolong.la.locus.com> scotte at locus.com (Scott D. Eberline) writes:
>I'm a bit resigned to having missing prototype warnings for the module
>that contains the function definitions.

As you have discovered, there is no correct way to use prototypes for
<varargs.h>-style variadic functions (when they are supported at all).

You ought to simply use the empty-parenthesis (old style) form of declaration
for such functions.

By the way, I take exception to the implementation warning you that no
prototypes exists, unles you have specifically asked for that check.
The C standard does not require that prototypes be used.

>How dangerous is it to call functions declared externally using the
>ellipsis notation, but defined using va_dcl?  May a conforming implement-
>ation assume that functions with ellipsis prototypes use <stdarg.h>-style
>arguments and not <varargs.h>-style?

The answer to the second question is "Certainly, and indeed it is likely."
Therefore the answer to the first question is that it is not a good idea.



More information about the Comp.std.c mailing list