This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Different behaviour of stdarg as function of platform, is this a bug?
- To: Zack Weinberg <zack at wolery dot cumb dot org>,Carlo Wood <carlo at alinoe dot com>
- Subject: Re: Different behaviour of stdarg as function of platform, is this a bug?
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Date: Thu, 8 Jun 2000 00:29:21 +0200
- Cc: gcc at gcc dot gnu dot org
- References: <20000607233403.A31184@a2000.nl> <20000607150818.L26551@wolery.cumb.org>
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.