passing variable numbers of arguments

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Jan 10 12:27:28 AEST 1989


In article <11378 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
>Yes, it does seem as though nargs() is not very useful for polymorphic
>functions.  (And, as Doug pointed out, the number-of-words implementation is
>bad--though this could be fixed by having nargs() return the number of bytes
>so that the application could say nb -= sizeof(TYPE), assuming it knows what
>type to expect next.)

No, if nargs() has any use at all it cannot be this.  The reason that
the va_ stuff must be used for portable access to arguments is that
many architectures do not have a simple, clean model for argument
alignment (which might be different from that indicated by sizeof),
and some pass some of the arguments different from others.  nbytes()
would be of no value in portable programming.



More information about the Comp.lang.c mailing list