Here is source code:
#include <stdarg.h>
void foo(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int a, b, d, e;
double c;
a = va_arg(ap, int);
va_end(ap);
}
And here is the code after preprocessing(ignoring #include and preprocessor comments(#)):
void foo(char *fmt, ...)
{
va_list ap;
__builtin_va_start(ap, fmt);
int a, b, d, e;
double c;
a = __builtin_va_arg(ap, int); // int as an argument after processing!
__builtin_va_end(ap);
}
so, how does __builtin_va_arg(ap, int) works ? When this macro expanded ?