[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: va_list (Was: Compile problem)

> > > Is va_list a real void * pointer, and if so why is it 12 bytes long?

It isn't.

> > > If not what is it so that gcc can't make by default a copy of it?

typedef struct __va_list_tag {
  unsigned char gpr;            /* index into the array of 8 GPRs stored in the
                                   register save area gpr=0 corresponds to r3,
                                   gpr=1 to r4, etc. */
  unsigned char fpr;            /* index into the array of 8 FPRs stored in the
                                   register save area fpr=0 corresponds to f1,
                                   fpr=1 to f2, etc. */
  char *overflow_arg_area;      /* location on stack that holds the next
                                   overflow argument */
  char *reg_save_area;          /* where r3:r10 and f1:f8, if saved are stored */
} __va_list[1], __gnuc_va_list[1];

from include/va-ppc.h in the gcc path.

> > Use va_copy(DEST, SRC) or __va_copy() if your version of GCC is
> > too old.
> Thanks for the tip, but what it do not understand is that I
> have gcc 2.95.4 (which I think can not be considered as old), but in
> my stdargs.g I only found __va_copy(), the other primitive doesn't not
> exist.
> You solution put me on the right way and this link raise (and solves) the problem :
> http://gcc.gnu.org/ml/gcc/1998-02/msg00835.html (dated 1998 !).

Their implementation (dest[0]=src[0]) is equivalent to the one used by gcc
(#define __va_copy(dest, src) *(dest) = *(src)). This problem exists from
the very beginning...

> Does anyone as anyexplanation on this fact?

It seems va_copy never made it into the standard, or the standard never
made it out the door. So all you have is __va_copy but that's defined
for all architectures supported by gcc. People just need to start using


Reply to: