varargs functions: calling and prototyping

Karl Heuer karl at haddock.ima.isc.com
Fri Jul 27 10:57:43 AEST 1990


In article <1990Jul25.195944.9238 at DRD.Com> mark at drd.Com (Mark Lawrence) writes:
>[A function defined with the <varargs.h> macros fails to match its prototype]

Don't use <varargs.h> in ANSI C.  Use <stdarg.h> instead.

>do I need to provide a terminating NULL when calling this function

Not in this case.  The function that ultimately parses the variadic part is
vsprintf, and it uses the format string, rather than a sentinel value, to
detect the end of the list.

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list