Can va_arg() be used as an lvalue?

Colin Plumb colin at array.UUCP
Sun Aug 5 09:52:59 AEST 1990


In article <1990Aug3.091749.10018 at hellgate.utah.edu> sandra%jensen.utah.edu at cs.utah.edu (Sandra Loosemore) writes:
>  Specifically, can I take the address of its
>return value?  It looks like it will work in the C implementations I
>currently have access to, but I'm not sure whether that's a bug or
>a feature.

Section 4.8.1.2: "The va_arg macro expands to an expression that has the
type and value of the next argument in the call."

In particular, not necessarily an lvalue, just a general expression.

Arguments need not be passed in addressible storage (registers are possible),
so taking the address is not guaranteed.

(Yes, most current compilers copy the arguments into memory so they can
refer to them from called procedures that are passed the va_list, but
a really intelligent compiler might do that only if the va_list is
passed to a called procedure, or something trickier.)
-- 
	-Colin



More information about the Comp.lang.c mailing list