next up previous contents index
Next: The va_arg macro Up: Variable argument list Previous: Variable argument list

The va_start macro

va_start must be called within the body of the function whose argument list is to be traversed. That function can then pass a pointer to its va_list object ap to other functions to do the actual traversal. (It can, of course, traverse the list itself.)

The parmN argument to va_start is an aid to writing conforming ANSI C code for existing C implementations. Many implementations can use the second parameter within the structure of existing C language constructs to derive the address of the first variable argument. (Declaring parmN to be of storage class register would interfere with use of these constructs; hence the effect of such a declaration is undefined behavior. Other restrictions on the type of parmN are imposed for the same reason.) New implementations may choose to use hidden machinery that ignores the second argument to va_start, possibly even hiding a function call inside the macro.

Multiple va_list variables can be in use simulaneously in the same function; each requires its own calls to va_start and va_end.

4 8 1 2


Pete Jinks
Fri Jan 19 12:31:56 GMT 1996