This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Calling va_start multiple times vs __va_copy


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]