varargs vs. prototypes

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Jun 9 06:08:58 AEST 1989


In article <237 at pink.ACA.MCC.COM> rfg at MCC.COM (Ron Guilmette) writes:
>Old (non-prototype) function declarations & definitions have
>been depreciated right?  So we really should *not* be using
>the old style anymore right?  We should do everything with
>prototypes right?

If you don't care about non standard-conforming implementations,
then you should use prototypes.  Otherwise, you should use the
__STDC__ predefined macro to select whether to use prototypes or
old-style declarations.  Some clever tricks to assist in this
have been previously posted, but you can do it the obvious way..

>So how can I write a function definition for a varargs function
>using prototypes?  Is this possible?

#include <stdarg.h>
ret_type func_name( type1 fixed_arg1, typen fixed_argn, ... )
	{ /* stuff using the va_* macros defined by <stdarg.h> */ }



More information about the Comp.std.c mailing list