va_start_1, va_start

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);

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.

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 DEC 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 value of the offset argument used in va_start_1 the implications of the OpenVMS calling standard must be considered.

On OpenVMS VAX, most argument items are a longword. For example, OpenVMS VAX arguments of types char and short use a full longword of memory when they are present in argument lists. However, OpenVMS VAX arguments of type float use two longwords because they are converted to type double.

On OpenVMS Alpha, 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 DEC C User's Guide for OpenVMS Systems or the OpenVMS Calling Standard.

The preceding version of va_start and va_start_1 is specific to the DEC 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);

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.

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.


Previous Page | Next Page | Table of Contents | Index