This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Standards question: va_list vs. va_list *
- From: Ulrich Weigand <weigand at immd1 dot informatik dot uni-erlangen dot de>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 19 Jan 2002 18:49:47 +0100 (MET)
- Subject: Standards question: va_list vs. va_list *
Hello,
on s390 (like in some other backends) we define va_list to
be of array type. From my reading of the standard, this
is supposed to be legal. However, we've had reports of a
peculiar problem caused by this. Consider this program:
#include <stdarg.h>
void func (va_list *app);
void test (va_list ap)
{
func (&ap);
}
Is this program conforming to the standard? The standard
says on the one hand that you can pass an object of type
va_list as argument, and on the other hand that it is legal
to form an va_list * by taking the address of a va_list object.
Combining these two in the form above, however, doesn't
work if va_list is in fact an array type, as the type of
the argument ap is implicitly adjusted to pointer type,
and thus &ap is not in fact of type va_list * ...
Does this mean it is illegal to define va_list as array
type after all? Or is the program above not conforming?
Thanks,
Ulrich
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de