By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,106 Members | 2,686 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,106 IT Pros & Developers. It's quick & easy.

reference to va_list

P: n/a
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

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));

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?


Rich Herrick

Jul 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.