Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!brutus.cs.uiuc.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: varargs vs. stdargs Message-ID: <11594@smoke.BRL.MIL> Date: 14 Nov 89 14:36:27 GMT References: Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 19 In article gnb@bby.oz (Gregory N. Bond) writes: >Is there some method of specifying varadic functions that is portable >to both old (varargs) and new (stdargs) implementations? The simple answer is that at some level you have to switch on __STDC__. >Is there an ANSI prototype for old varargs functions? No, such functions were not legal C although they happened to work in most implementations. Because of the widespread use of printf() in applications, it behooved implementors to figure out some solution. >Or do I have two prototyes and two implementations surrounded by >#if __STDC__? Some people use macros to make this a bit less painful, but in any event in the definition of the body of a variadic function you have to pick up the "fixed" arguments via va_arg() for varargs, but they're already accessible under stdarg.