Subject: Re: va_list pointers, bad(?) gcc code
To: None <email@example.com, firstname.lastname@example.org>
From: Frank van der Linden <email@example.com>
Date: 11/11/2003 13:12:03
I think the issue here is that it creates a reference to a va_list passed
as a parameter. va_list is an array of <sometype>.
So it's passing it as <sometype *>. Then vfoo1 creates another indirection,
and makes it <sometype **>.
If it does:
vfoo0(const char *fmt, ...)
..then it works, because that just is &<array of somettype> ==
&<array of sometype>.
In other words, passing references to a 'fresh' va_list on the stack,
inited with va_start, is fine, but taking a reference to a va_list
passed in as a pointer is not portable.
Although the C language standard is a bit too broad here.. it should
probably expliticly say that. I see now way to make this construction
work properly if va_list is an array type..
Frank van der Linden firstname.lastname@example.org
NetBSD. Free, Unix-like OS. > 45 different platforms. http://www.netbsd.org/