Johan Lindh <jo***@linkdata.getridofthis.se> wrote:
Jeremy Yallop wrote:
Johan Lindh wrote:
If I read the standard correctly, a va_list variable
that's initialized using va_copy() should be terminated
with a va_end() on it. Is this correct?
Yes. Note that the relevant text has changed between n869 and C99.
I only have the C99; if it's needful to know the n869 (whatever THAT
is... =), please post it.
N869 is the last public draft of the ISO/IEC 9899:1999 standard
and is available at:
http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/.
n869 7.15.1.3 (The va_end macro):
[...]
[#2] The va_end macro facilitates a normal return from the
function whose variable argument list was referred to by
the expansion of va_start that initialized the va_list ap.
The va_end macro may modify ap so that it is no longer
usable (without an intervening invocation of va_start).
If there is no corresponding invocation of the va_start
macro, or if the va_end macro is not invoked before
the return, the behavior is undefined.
ISO/IEC 9899:1999(E) 7.15.1.3 (The va_end macro):
[...]
2 The va_end macro facilitates a normal return from the function
whose variable argument list was referred to by the expansion
of the va_start macro, or the function containing the expansion
of the va_copy macro, that initialized the va_list ap. The
va_end macro may modify ap so that it is no longer usable
(without being reinitialized by the va_start or va_copy macro).
If there is no corresponding invocation of the va_start or
va_copy macro, or if the va_end macro is not invoked before the
return, the behavior is undefined.
HTH
Regards
--
Irrwahn Grausewitz (ir*******@freenet.de)
welcome to clc :
http://www.ungerhu.com/jxh/clc.welcome.txt
clc faq-list :
http://www.eskimo.com/~scs/C-faq/top.html
acllc-c++ faq :
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html