Subject: Re: va_list pointers, bad(?) gcc code
To: None <,>
From: Frank van der Linden <>
List: port-amd64
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, ...)
        va_list ap;

        va_start(ap, fmt);
        vfoo2(fmt, &ap);

..then it works, because that just is &<array of somettype> ==
&<array of sometype>[0].

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

Frank van der Linden                                  
NetBSD. Free, Unix-like OS. > 45 different platforms.