Re: backtrace

From: Date: Thu, 31 Aug 2000 20:45:16 +0000
Subject: Re: backtrace
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-31504@lists.php.net to get a copy of this message
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@zend.com> http://www.zend.com/

« previous php.dev (#31504) next »