Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!csd4.csd.uwm.edu!bionet!ames!indri!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: va_list used inKeywords: va_list, X3J11, vfprintf Message-ID: <10766@smoke.BRL.MIL> Date: 17 Aug 89 15:42:21 GMT References: <1140@midgard.Midgard.MN.ORG> <10720@smoke.BRL.MIL> <2095@dataio.Data-IO.COM> <10739@smoke.BRL.MIL> <13572@bloom-beacon.MIT.EDU> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 56 In article <13572@bloom-beacon.MIT.EDU> scs@adam.pika.mit.edu (Steve Summit) writes: >...which is difficult if the implementor of is not also >the implementor of . It is, reasonably I think, assumed that the Standard C implementation on a system is provided as a single integrated whole, rather than assembled piecemeal from several uncooperative sources. >deep breath, and add something like va_list.h: > #ifndef _VA_LIST > #define _VA_LIST > typedef int *__va_list; > #endif > would then contain > #include > typedef __va_list va_list; >and would contain > #include > extern int vfprintf(FILE *, char *, __va_list); That's one way to correctly implement these headers (except that the "char*" parameter should be "const char*"). >(I'd probably have to do the same thing for off_t, because >if fseek() doesn't take one, it should. Schade, off_t is in >1003.1's baliwick, not X3J11's.) Also note that size_t and NULL are defined in more than one standard header; NULL is not much of a problem because of benign redefinition, but since size_t is a typedef it must be protected by some sort of one-time interlock. >It is apparently impossible to write a correct, standalone , >which is what Dale Schumacher is trying to do. Sure it is, along the lines I suggested. It just won't be fully portable, that's all. But nobody claimed that a fully portable implementation of the standard C library was possible in the first place. Actually I don't think you are absolutely required to use prototypes in the standard header function declarations, except for the ,... functions (which vfprintf() is not). >Also in article <10720@smoke.BRL.MIL>, Doug writes: >>Warning! Use __iob or _Iob, not _iob, in your . >I'm not sure what is implied here. You should read Sue Meloy's article in the Journal of C Language Translation. Consider: #include func() { int _iob; _iob = getchar(); }