Varargs implementation (was Re: Addresses of parameters)

Bob Larson blarson at skat.usc.edu
Thu Oct 27 16:34:27 AEST 1988


In article <23385 at amdcad.AMD.COM> tim at crackle.amd.com (Tim Olson) writes:
>How do you suppose varargs functions are implemented?  

In whatever machine/os/compiler specific way that is handy.

>They must take
>the address of the first parameter to "step through" the parameter list.

"must"?  I've written a couple of varargs implementations, and banged on
another.  I don't seem to recall any such requirement in the varargs specs,
and in fact that is not how I did it on the one I wrote for a system that
does pass the first two (with exceptions) arguments in registers.  Maybe
some do it that way, but that does not imply that that is the only way.

>Are you suggesting that varargs functions are not portable and should be
>avoided?

That was not my assertion, but note that ANSI decided vararg.h wasn't
portable enough so came up with stdarg.h.  (The compiler I mentioned
above would need internal support for stdarg.h while vararg.h can be added
as an afterthought.  Is this increased portability?)
-- 
Bob Larson	Arpa: Blarson at Ecla.Usc.Edu	blarson at skat.usc.edu
Uucp: {sdcrdcf,cit-vax}!oberon!skat!blarson
Prime mailing list:	info-prime-request%ais1 at ecla.usc.edu
			oberon!ais1!info-prime-request



More information about the Comp.lang.c mailing list