This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]