[comp.lang.c] Does stdio.h require stdargs.h?

lmb@ghoti.uucp (Larry Breed) (11/23/89)

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?


Disclaimer: Don't blame my employer, blame:
Larry Breed			(415) 855-4460
uucp: uunet!ibmsupt!lmb		inet: ibmsupt!lmb@uunet.uu.net

gwyn@smoke.BRL.MIL (Doug Gwyn) (11/28/89)

In article <3032@ibmpa.UUCP> lmb@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.