<stdarg.h> (requires <stdio.h>?)

Rex Jaeschke rex at aussie.UUCP
Mon Apr 10 04:01:42 AEST 1989


> This strikes me as a bug.

I believe it is in an ANSI-conformant implementation.

> but does it ever say
> you have to #include one before you can #include another?

No. Every standard header must be self-sufficient (there may be notable 
exceptions documented there) - it can't really #include another
standard header itself since NULL, for example, is only defined when
one of the 5 or 6 standard headers it is defined in, is included by
the programmer.  ANSI places no requirement you include stdio before
using stdarg and requiring you to do so MUST be non-standard.

A std header could only include another std header as long as it 
could undo every name brought in with it after it used those it 
needed, and that is generally impossible, certainly for structure 
templates and typedefs since there is no way to forget about them once 
declared.

A similar situation occurs with MSF V5.1 in assert.h. assert calls 
fprintf which requires stderr, a macro only defined in stdio. 
(Actually, MSf's assert needs quite a bit of surgery to be 
conformant.)

Rex

----------------------------------------------------------------------------
Rex Jaeschke     | C Users Journal     |  Journal of C Language Translation
(703) 860-0091   | DEC PROFESSIONAL    |1810 Michael Faraday Drive, Suite 101
uunet!aussie!rex | Programmers Journal |     Reston, Virginia 22090, USA
----------------------------------------------------------------------------



More information about the Comp.std.c mailing list