Jesse Ziser writes:
Indeed. The C99 standard, section 7.15 (Variable arguments <stdarg.h>),
note 212:
"It is permitted to create a pointer to a va_list and pass that pointer
to another function, in which case the original function may make
further use of the original list after the other function returns."
Though footnotes are not normative, and the rest of the section can be
read as allowing this usage to break. I vaguely seem to remember that
has even happened - a DR resulted in the decision that some footnote was
wrong. So you are not _quite_ C99-safe, but it seems safe enough.
--
Hallvard
I'm trying to write a function that takes a very complex variable
argument list. It is so complex, in fact, that it can only be parsed by
calling a bunch of functions, each of which parses another little piece
of the argument list.
(...)
So, I reasoned, why not pass a va_list * instead of a va_list?
argument list. It is so complex, in fact, that it can only be parsed by
calling a bunch of functions, each of which parses another little piece
of the argument list.
(...)
So, I reasoned, why not pass a va_list * instead of a va_list?
note 212:
"It is permitted to create a pointer to a va_list and pass that pointer
to another function, in which case the original function may make
further use of the original list after the other function returns."
Though footnotes are not normative, and the rest of the section can be
read as allowing this usage to break. I vaguely seem to remember that
has even happened - a DR resulted in the decision that some footnote was
wrong. So you are not _quite_ C99-safe, but it seems safe enough.
--
Hallvard