🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1542

Re: vprintf()

#1542
From: Doug Gwyn
Date: Tue, 31 Jul 1990 01:15
42 lines
2788 bytes
In article <1990Jul30.182656.19169@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
>In article <13450@smoke.BRL.MIL> gwyn@smoke.BRL.MIL (Doug Gwyn) writes:
>>>>Is vprintf() mandated to be in <stdio.h> by ANSI C...
>>>Yes.  (Although you have to include <stdarg.h> as well.)
>>You don't have to include <stdarg.h> to get vprintf() properly defined,
>>just <stdio.h>...
>Can you prove this?  Unless this got changed since the late draft that
>is all I've got (must get a copy of the final standard, sigh...), the
>specs for the v* functions all call for <stdarg.h> before <stdio.h>.
>On a quick search, I find no explicit statement to the effect that
>either (a) <stdio.h> suffices, or (b) <stdarg.h> is required.

4.1.2.1 states that the header for the section (4.9, i.e. <stdio.h>)
declares or defines all identifiers listed for its section; it doesn't
say or imply that it may need any help in doing so.  The "Synopsis"
subsections are just a funny sort of pseudo-source method of showing
what the function interfaces are like; in fact, as 4.1.6 points out,
in most cases the functions can be declared without use of any
standard header.  The reason for <stdarg.h> in the v*printf() Synopses
is that the interface is shown in terms of the va_list type, and
inclusion of <stdarg.h> is the only method by which a strictly
conforming application could get that type defined.  Note, however,
that a conforming implementation must NOT naively invoke <stdarg.h>
to obtain a definition for va_list for use in the v*printf()
declarations within <stdio.h>.  This was explained in the response to
a letter in the third round of public review of the draft proposed
standard:

	Response to Letter 185 (X3J11/88-145) issue summarized as
	"va_list must also be defined in stdio.h>":

	va_list need not, indeed must not, be defined in <stdio.h>.

	typedefs do not create new types, merely synonyms for other
	types.  In <stdio.h> function prototypes an implementation
	has to use the type that it would define for va_list in
	<stdarg.h>.  For example, if a void * is chosen for va_list,
	the prototype for vprintf, vfprintf, and vsprintf would just
	use void *.

This question has come up several times, and that has always been the
response.
Technical Details
Message-ID: <13455@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!ncifcrf!lhc!adm!smoke!gwyn
References: <1990Jul28.211947.3795@zoo.toronto.edu> <13450@smoke.BRL.MIL> <1990Jul30.182656.19169@zoo.toronto.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!ncifcrf!lhc!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: vprintf()
Message-ID: <13455@smoke.BRL.MIL>
Date: 31 Jul 90 01:15:38 GMT
References: <1990Jul28.211947.3795@zoo.toronto.edu> <13450@smoke.BRL.MIL> <1990Jul30.182656.19169@zoo.toronto.edu>
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 42