Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!mit-eddie!wuarchive!udel!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: prototypes required ? Keywords: printf stdargs prototypes Message-ID: <14195@smoke.BRL.MIL> Date: 19 Oct 90 15:09:27 GMT References: <4026@otis.oakhill.UUCP> <14164@smoke.BRL.MIL> <2150@lupine.NCD.COM> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 33 In article <2150@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes: >Now please excuse my almost total ignorance regarding the x3j11 requirements >regarding the contents of include files, but I don't immediately see where >(in 4.9.1) it says (explicitly) what function are required to be declared >within . Are all of the function listed in 4.9.4 thru 4.9.10 >required to have declarations within ? If so, are they required >to have prototyped declarations? Non-prototyped? Either? Section 4.1.2.1 says: "Each header declares or defines all identifiers listed in its associated section, ..." While it does not explicitly require that prototypes be used, a strictly conforming program must assume that the standard headers might use prototypes. Otherwise, it would be depending on undefined behavior. Of course it is expected that high-quality implementations WOULD use prototypes in the standard headers, because that would produce better diagnostic capabilities due to being able to check argument types. >... put a declaration like the following in it: > int vfprintf (FILE *, const char *, void *); >I tried changing the last formal type to (a more correct) `va_list', ... must not rely on the inclusion of nor include itself. The v*() declarations in should have the appropriate type directly used in the declaration (i.e. not via a typedef), or else they should use an implementation-reserved identifier for the typedef. For example: /* example implementation (partial) */ #include /* defines __va_list etc. */ /* [FILE defined here] */ int vfprintf(FILE *, const char *, __va_list); With this technique, the same file () can be used in the implementation of both and .