Jesse Ziser writes:
Well, you could call va_copy() before passing the va_list to foo(),
which records somewhere the types of the arguments it grabbed. Then the
caller walks past these args in the original va_list, just discarding
the args which foo says it has parsed.
for(;;) switch (*argtypes_eate n_by_foo++) {
case 's': (void) va_arg(ap, char *); break;
case 'i': (void) va_arg(ap, int); break;
...
}
Cumbersome though. However in some cases it simplifies parsing to
do it in two passes.
--
Hallvard
I don't think va_copy() helps with what I'm trying to do,
unless I'm missing something.
unless I'm missing something.
which records somewhere the types of the arguments it grabbed. Then the
caller walks past these args in the original va_list, just discarding
the args which foo says it has parsed.
for(;;) switch (*argtypes_eate n_by_foo++) {
case 's': (void) va_arg(ap, char *); break;
case 'i': (void) va_arg(ap, int); break;
...
}
Cumbersome though. However in some cases it simplifies parsing to
do it in two passes.
--
Hallvard