Jesse Ziser <d...@spam.diew rote:
The detail in VARIABLE ARGUMENTS explicitly allows it.
Nothing prohibits it. Only va_start and va_end must
'be invoked in the function accepting varying number
of arguments.'
They might accidentally screw it up, but the semantics
seem pretty clear.
C99 introduced va_copy, but that was so that the
same list could be rescanned from a given point
without starting afresh with another va_start.
But it doesn't appear that you need to do that.
--
Peter
void parse_half_of_a rg_list( va_list *args )
{
...
foo_t x = va_arg( *args, foo_t );
bar_t y = va_arg( *args, bar_t );
...
}
>
void superfunc( int a, ... )
{
va_list args;
va_start( args, a );
parse_half_of_a rg_list( &args );
parse_half_of_a rg_list( &args );
va_end( args );
}
>
I haven't been able to find anything in any standard
that explicitly allows or prohibits this.
{
...
foo_t x = va_arg( *args, foo_t );
bar_t y = va_arg( *args, bar_t );
...
}
>
void superfunc( int a, ... )
{
va_list args;
va_start( args, a );
parse_half_of_a rg_list( &args );
parse_half_of_a rg_list( &args );
va_end( args );
}
>
I haven't been able to find anything in any standard
that explicitly allows or prohibits this.
Nothing prohibits it. Only va_start and va_end must
'be invoked in the function accepting varying number
of arguments.'
but there aren't many ways I can think of that
some devious library author could screw this up.
some devious library author could screw this up.
seem pretty clear.
C99 introduced va_copy, but that was so that the
same list could be rescanned from a given point
without starting afresh with another va_start.
But it doesn't appear that you need to do that.
--
Peter
Comment