I have a few questions regarding variable numbers of arguments:
Why va_start, va_argand are va_enddefined as macros, and not as functions?
va_start
va_arg
va_end
How does it work va_start? Does it have access to the stack of function calls and bypasses the stack until it finds the last argument specified?
The rationale for why they are macros is described in The rationale for international standard programming languages-C in the 7.15Variable Arguments section, he says:
7.15
va_start va_arg , va_start , , va_arg , .
C , x86:
typedef char *va_list; #define va_start( list, param ) (list = (va_list)(¶m + sizeof( param ))) #define va_arg( list, type ) (*(type *)((list += sizeof( type )) - sizeof( type ))
++ ++?, , .
va_end , , , va_start ( & , ). va_end va_start , & , .
&
va_arg , , .
va_start , : , , , .
va_list, ( va_start), , va_arg, .
va_list
va_start, va_arg va_end , ( ) .
, , . , . , va_arg , , ( ).