Used for initializing a variable to the beginning of the argument list. Format #include <varargs.h> (DEC C Extension) void va_start (va_list ap); void va_start_1 (va_list ap, int offset);
1 – Arguments
ap An object pointer. You must declare and use the argument ap as shown in the format section. offset The number of bytes by which ap is to be incremented so that it points to a subsequent argument within the list (that is, not to the start of the argument list). Using a nonzero offset can initialize ap to the address of the first of the optional arguments that follow a number of fixed arguments.
2 – Description
The va_start macro initializes the variable ap to the beginning of the argument list. The va_start_1 macro initializes ap to the address of an argument that is preceded by a known number of defined arguments. The printf function is an example of a C RTL function that contains a variable-length argument list offset from the beginning of the entire argument list. The variable-length argument list is offset by the address of the formatting string. When determining the value of the offset argument used in va_ start_1, the implications of the OpenVMS calling standard must be considered. On OpenVMS Alpha and Integrity server systems, each argument item is a quadword. NOTE When accessing argument lists, especially those passed to a subroutine (written in C) by a program written in another programming language, consider the implications of the OpenVMS calling standard. For more information about the OpenVMS calling standard, see the VSI C User's Guide for OpenVMS Systems or the VSI OpenVMS Calling Standard. The preceding version of va_start and va_start_1 is specific to the C RTL, and is not portable. The following syntax describes the va_start macro in the <stdarg.h> header file, as defined in the ANSI C standard: Format #include <stdarg.h> (ANSI C) void va_start (va_list ap, parmN);
3 – Arguments
ap An object pointer. You must declare and use the argument ap as shown in the format section. parmN The name of the last of the known fixed arguments.
4 – Description
The pointer ap is initialized to point to the first of the optional arguments that follow parmN in the argument list. Always use this version of va_start in conjunction with functions that are declared and defined with function prototypes. Also use this version of va_start to write portable programs. For an example of argument-list processing using the <stdarg.h> functions and definitions, see the "Character, String, and Argument-List Functions" chapter of the VSI C RTL Reference Manual.