Hello GCC List. I am not on this list, so please keep me cc:'d on any replies.
I recently found something about C that I do not like at all. I was enraged and furious! I blogged! http://blogs.gnome.org/desrt/2007/08/22/isoiec-98991999-e-%c2%a7-67537/ I am proposing the following feature for GCC to mitigate the problem: a new macro (defined in <stdarg.h> under -std=gnu99 or an appropriate #define) called va_ref(). va_ref() would be defined in such a way as to allow the following program to be correct and to output --snip-- 1 = 1 2 = 2 --snip-- #include <stdarg.h> #include <stdio.h> static void print (int x, va_list *app) { printf ("%d = %d\n", x, va_arg (*app, int)); } static void do_both (va_list ap) { print (1, va_ref (ap)); print (2, va_ref (ap)); } static void varfunc (int ignore, ...) { va_list ap; va_start (ap, ignore); do_both (ap); va_end (ap); } int main (void) { varfunc (0, 1, 2); return 0; } Essentially, on machines where va_list has a structure or scalar type, you would have something to the effect of #define va_ref(x) (&(x)) and on machines with va_list as an array you would have something like #define va_ref(x) ((va_list *)(x)) That is all. Cheers