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

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Wed Jun 7 15:29:00 GMT 2000


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.


More information about the Gcc mailing list