Does stdio.h require stdargs.h?

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Nov 28 07:53:47 AEST 1989


In article <3032 at ibmpa.UUCP> lmb at ibmsupt.UUCP (Larry Breed) writes:
>The Standard's synopsis of vprintf is --
>	#include <stdarg.h>
>	#include <stdio.h>
>	int vprintf(const char *format, va_list arg);
>Presumably stdio.h contains the prototype declaration for vprintf.
>But without stdarg.h, va_list is undefined.  This seems to require
>anyone who includes stdio.h to include stdarg.h as well.
>Have I missed something?

Hi, Larry.  Gee, we seem to have this same question or an analogous
one every couple of months.  The answer is that the application need
include only <stdio.h>.  It is up to the implementation to make this
work.  The usual implementation technique is to supply the proper
type in place of "va_list" in the prototype inside <stdio.h>.
Because typedefs do not create separate types but merely serve as
shorthand for ones that could be specified in "raw C", it is always
possible to avoid using defined types -- assuming you know the
correct equivalent, as the implementor must.



More information about the Comp.lang.c mailing list