Calling va_start multiple times vs __va_copy

Robert Lipe robertlipe@usa.net
Wed Aug 8 06:28:00 GMT 2001


Sebastian Ude wrote:

> Is it legitime to parse the optional arguments in a variadic function
> multiple times _without_ copying the va_list through (__)va_copy ?

The standard doesn't appear to forbid it.  In the non-normative text
if Plauger's "The Standard C Library" it says "Once ou execute va_end
you must not again execute va_arg unless you first execute va_start to
initiate a rescan."    This appears to give extra credence to the 
restartability.

> Can a va_list be started multiple times through va_start ?

As long as there are matching va_ends, yes.

> But, __va_copy does not belong to the ISO standard, right ? 

'__va_copy' does not, but 'va_copy' does appear in C99.

RJL



More information about the Gcc mailing list