Guardian C Library Calls Reference Manual
va_start
3-232 128833—Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
va_start
The va_start macro initializes its first argument for use as the retainer of a list that
contains the variable number of arguments. This first argument, ap, can then be used by
va_arg and va_end to extract arguments from the list.
ap
is the variable of type va_list that va_start initializes for use as a retainer for the list
that contains the variable number of arguments.
<last_parm>
is the identifier of the last parameter in the declaration of the function that is using
the variable number of arguments. This identifier, then, is the name of the parameter
immediately preceding the ellipsis (...) in the function declaration.
Return Value
none.
Usage Guidelines
•
You must invoke va_start before accessing the list that contains the variable number
of arguments.
•
In the declaration of the function that uses the variable number of arguments, the
parameter <last_parm> cannot have the register storage class.
•
Successive invocations of va_start reset ap to the first argument in the variable
argument list. This resetting enables a function you write to reuse the arguments in
the list (as the fprintf family of functions does).
#include <stdargh>
void va_start(va_list ap, <last_parm>);