Args: var number & var types

Henry Spencer henry at utzoo.uucp
Sat May 14 06:34:37 AEST 1988


> Is there any way to declare a function to have two arguments point to the same
> place in the stack-frame? ...

Well, sort of.  If you can make the problem printf-like, with earlier
arguments of fixed types determining the variable-type arguments, then
whatever method your implementation uses for printf should suffice.
If your implementation has a <stdargs.h> header, use that.  Second choice is
<varargs.h>.  If you have neither of those, it's still possible but the code
will be highly implementation-specific and it's difficult to supply specific
advice.

Note that this is *not* a general way of having two arguments in the same
location; to do that you have to use unions, and doing *that* portably
requires that the caller know about it.
-- 
NASA is to spaceflight as            |  Henry Spencer @ U of Toronto Zoology
the Post Office is to mail.          | {ihnp4,decvax,uunet!mnetor}!utzoo!henry



More information about the Comp.lang.c mailing list