so if your goal is to achieve va_copy on both C89 and C99 systems,
you can resort to something like:
#ifndef va_copy
/* WARNING - DANGER - ASSUMES TYPICAL STACK MACHINE */
#define va_copy(dst, src) ((void)((dst) = (src)))
#endif
You can dress up the "#define" in further #ifdefs to check for
known machine types (e.g., the usual powerpc va_copy is more
complicated), or you can just require that anyone porting the
software provide a "machdep/stdarg.h" header or some such, that
uses the existing C99 <stdarg.h> if it exists, or else adds the
C99 va_copy() macro atop the existing C89 <stdarg.h>.
Also, you could write a test program that "experiments with" any
va_copy you define, to see if a simple "copy the value bits" approach
works. If you pass integers (int and long and, in C99, long long;
char and short widen), floating-point values (double and long
double; float widens), and several different types of pointers,
and can access all of those correctly, you are probably close.
Add struct and union objects of varying sizes and you will test
the usual remaining special cases (and you may even discover that
the system-supplied <stdarg.h> breaks when va_arg is supposed to
extract a structure -- not that I know of particular systems where
this occurs; it just seems likely).
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it
http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to