Path: utzoo!attcan!uunet!hsi!stpstn!lerman From: lerman@stpstn.UUCP (Ken Lerman) Newsgroups: comp.lang.c Subject: Re: varargs...help appreciated Keywords: varargs Message-ID: <5773@stpstn.UUCP> Date: 5 Nov 90 21:13:49 GMT References: <1990Nov2.170614@madmax.Viewlogic.COM> <27416@mimsy.umd.edu> Reply-To: lerman@stpstn.UUCP (Ken Lerman) Organization: The Stepstone Corporation, Sandy Hook, CT 06482 Lines: 34 In article <27416@mimsy.umd.edu> chris@mimsy.umd.edu (Chris Torek) writes: ... [->> has lost attribution.] ->>p.s. Anyone got any varargs macros, portable between ->> traditional varargs and ANSI stdarg? -> ->If you mean what I think you mean, it cannot be done. The reason ->is that `va_start' has the same name in and ->but the former version (used above) has only one parameter while the ->latter has two. It is thus impossible to write a single implementation. -> ->If you mean the other thing I think you mean, it can be done, but it ->looks horrible (and I will not even give an example). ->-- ->In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750) ->Domain: chris@cs.umd.edu Path: uunet!mimsy!chris I generally put the following in my code (by #include): #if defined(__STDC__) && __STDC__ != 0 #include #define VA_START(ap,last) va_start(ap,last) #else #include #define VA_START(ap,last) va_start(ap) #endif Then I can write VA_START(ap, lastArg) in my code as if I'm using the ANSI style of va_start. While this is not a single va_start which does both, I think it meets the portablility goals which were stated. Ken