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]

Re: Different behaviour of stdarg as function of platform, is this a bug?


On Thu, 08 Jun 2000, Zack Weinberg wrote:
> I think the footnote means you could get the ppc/linux behavior
> reliably by writing
>
> void vfoo(va_list *vl)
> {
>   int a, b;
>   a = va_arg(*vl, int);
>   b = va_arg(*vl, int);
>   printf("vfoo: %d %d\n", a, b);
> }
>
> void foo(int x, ...)
> {
>   int i;
>   va_list vl;
>   va_start(vl, x);
>   for (i = 0; i < 2; ++i)
>     vfoo(&vl);
>   va_end(vl);
> }
>
> but I would not do this in code intended to be portable.

No, this doesn't change anything :-), va_list is an array in PPC-SYSV ABI, so 
it will always be passed as a pointer.

Franz.

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