![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: Is there a decent implementation/support of varargs.h (stdarg.h) for 64bit applications? According to the definitions in both headers there is only _ptr32 support. The Answer is : Do not be confused by the cast to __char_ptr32 seen within the va_start and va_arg macros. As you can observe from the attached example, the macros allow retrieving (long long) quadword values. $ pipe cc x ; link x ; run x 44bb0 $ pipe cc/poin=long x ; link x ; run x 80000010 x.c --- #include <stdarg.h> #include <stdio.h> #include <stdlib.h> void foo(int i, ...) { va_list ap; void *ptr; va_start(ap, i); ptr = va_arg(ap, void*); printf("%llx\n", ptr); main () { void *ptr = malloc(1); foo(0, ptr);
|