Re: [PHP-DEV] backtrace From: Zeev Suraski (zeev <email protected>)
Date: 08/31/00

On Thu, 31 Aug 2000, Sascha Schumann wrote:

> The standard says otherwise.

Regardless of whatever standard you pull from your sleeves, it's wrong if
it says it doesn't :) You either misread the standard, or misread what I
said (or the standard's dead wrong).

va_arg() modifies va_list, otherwise, the next va_arg() 'call' would
return the same thing. The reason this behavior does not matter in the
case of the recent php_error(), is that you don't traverse the va_list,
but rather, pass it as an argument to a function that does. As it's a
by-value argument, it's "mostly" safe to do it (it could still
theoretically make changes that would affect the outside world, as it can
be a pointer to a structure, for instance), even though in this regard,
the standard you may pull from your sleeves may suggest it's always safe).

>
> > Many platforms that define va_list as a simple pointer, reset it to NULL on
> > va_end(), which makes it useless afterwards.
>
> That behaviour is in conformance with ISO C99, SuS II and
> the upcoming SuS III (successor of POSIX).
>
> "void va_end(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). [..]"
>
> Note the part about reinitialization.

That's exactly what I said - I said that this stale va_end(), with no
assignment to complement it, caused trouble on many platforms, because
va_end() often kills the va_list it's fed with.

Zeev

-- 
Zeev Suraski <zeev <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>