Re: varargs related bug in gtk-gnutella
On Sun, Jul 21, 2002 at 01:22:12PM -0400, Daniel Jacobowitz wrote:
> You're right. Using a va_list after it has been passed to a function
> which uses it has undefined behaviour, IIRC. You probably want to call
> va_copy, pass the copy to the child function, and then (to be
> technically correct) va_end it in the caller.
Sounds about right... from the manpage:
If ap is passed to a function that uses va_arg(ap,type)
then the value of ap is undefined after the return of that
Reading the rest of the page, however, I don't see any reason not to
re-initialize a va_list with a new va_start afterwards, even if it its
value does become undefined first.
To UNSUBSCRIBE, email to email@example.com
with a subject of "unsubscribe". Trouble? Contact firstname.lastname@example.org