Is va_list defined by <stdio.h>?

Stephen Clamage steve at taumet.com
Sat Apr 13 01:28:25 AEST 1991


bhoughto at bishop.intel.com (Blair P. Houghton) writes:

>In article <15781 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
>>Many of the top C experts in the world disagreed with you.
>>I think the standard has this exactly right.

>Is there a good reason why v*printf() aren't declared in <stdarg.h>?

>The only one I can think of is an issue of categorization
>that seems to have overwhelmed one of usage.

>How could you use v*printf() without <stdarg.h>?

v*printf() aren't declared in <stdarg.h> because you would need to
declare FILE in it, and this would blow the modularity -- you would have
a type and functions declared whenever you used stdargs, even if you did
not want standard I/O.  Remember, if you do not include <stdio.h> FILE
and v*printf are not reserved for use as local identifiers.

You cannot USE v*printf() without including <stdarg.h>, but you can
DECLARE them.  Thus:
1.  You may include <stdio.h> without <stdarg.h> if you do not need
    v*printf().
2.  You may include <stdarg.h> without <stdio.h> if you do not need 
    standard I/O.
3.  You must include both headers if you want to use v*printf().

This seems like entirely reasonable modularity to me.  You pay for
what you want to use.
-- 

Steve Clamage, TauMetric Corp, steve at taumet.com



More information about the Comp.std.c mailing list