Re: backtrace
| From: | Sascha Schumann | Date: | Thu, 31 Aug 2000 18:51:11 +0000 |
| Subject: | Re: backtrace | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-31484@lists.php.net to get a copy of this message | ||
On Thu, 31 Aug 2000, Zeev Suraski wrote:
> At 21:22 31-08-00, Sascha Schumann wrote:
> >On Thu, 31 Aug 2000, Zeev Suraski wrote:
> >
> > > At 18:33 31-08-00, Sascha Schumann wrote:
> > > >On Thu, 31 Aug 2000, Stanislav Malyshev wrote:
> > > >
> > > > > j>> called with a null list of var_args, which is causing it to barf.
> > > > > j>> Problem is, the variable orig_args is being cleared on line 369
> > > > > j>> (va_end()), and
> > > > > j>> then being reused on line 444.
> > > > >
> > > > > Sorry, don't see any va_end in current CVS.
> > > >
> > > > The old_args stuff was removed some weeks ago (if we are
> > > > talking about main/main.c). The author of the original code
> > > > did not seem to be aware of the correct va_args use.
> > >
> > > Actually, the original version was quite alright, except for under very
> > > weird platforms, which define va_list as a type that cannot be copied
> > > (probably some sort of an array).
> >
> > It was not necessary at all to copy it. That is where I saw
> > the basic misunderstanding. A va_list can be traversed
> > multiple times without copying it.
>
> A va_list cannot be traversed multiple times, which is why the code was
> originally there (I think).
The standard says otherwise.
> 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.
- Sascha