Is it defined behavior to use a reference to a va_list to allow calling a
function to extract arguments from the argument list, then upon returning to
the calling function, continue extracting additional arguments. For
example:
int foo2(va_list& list)
{
return int(va_arg(list, int));
}
void foo(int x, ...)
{
va_list list;
va_start(list, x);
int a = foo2(list);
int b = int(va_arg(list, int));
va_end(list);
printf("%d %d %d\n", x, a, b);
}
Ignoring why someone would do this, would calling foo(1, 2, 3) print the
values of the three variables x, a, and b as 1, 2, and 3, respectively?
Thanks,
--
Rich Herrick
http://www.richherrick.com