Varargs in C

phil at RICE.ARPA phil at RICE.ARPA
Sun Sep 2 08:13:01 AEST 1984


From:  William LeFebvre <phil at RICE.ARPA>

> As for type information for each argument, it is not clear that this is
> useful in most cases... The callee would either ignore it, or blow up if
> it is wrong (at great expense of decoding the type info...).

What about arguments of different sizes?  On a VAX, everything is
passed on the stack in four bytes, except for floating point numbers
(such as a "double").  If your stack frame tells you the number of
bytes that were passed to a routine, you would still not be able to
tell how many arguments were passed, because you don't know the size of
each argument.  The type information would tell you.  In fact, even if
you had both the number of bytes and the number of arguments, you still
wouldn't be able to pull out the appropriate arguments in all cases.
As an example, if the caller passes an int and a double, the function
still won't know which order they were passed in, despite the fact that
he knows that there are 2 arguments and 12 bytes.

                                William LeFebvre
				Department of Computer Science
				Rice University
                                <phil at Rice.arpa>



More information about the Comp.lang.c mailing list