United States    
COMPAQ STORE | PRODUCTS |
SERVICES | SUPPORT | CONTACT US | SEARCH
C++
cxx$help.HLP

Builtin_Functions

Built-in functions allow you to directly access hardware and machine instructions to perform operations that are cumbersome, slow, or impossible in pure C.

These functions are efficient because they are built into the C++ compiler. This means that a call to one of these functions does not result in a reference to a function in the C run-time library or in your programs. Instead, the compiler generates the machine instructions necessary to carry out the function directly at the call site. Because most of these built-in functions closely correspond to single VAX or Alpha machine instructions, the result is small, fast code.

Some of these functions (such as those that operate on strings or bits) are of general interest. Others (such as the functions dealing with process context) are of interest if you are writing device drivers or other privileged software. Some of the functions are privileged and unavailable to user mode programs.

Be sure to include the <builtins.h> header file in your source program to access these built-in functions.

C++ supports the #pragma builtins preprocessor directive for compatibility with VAX C, but it is not required.

Some of the built-in functions have optional arguments or allow a particular argument to have one of many different types. To describe different valid combinations of arguments, the description of each built-in function may list several different prototypes for the function. As long as a call to a built-in function matches one of the prototypes listed, the call is valid. Furthermore, any valid call to a built-in function acts as if the corresponding prototype was in scope, so the compiler performs the argument checking and argument conversions specified by that prototype.

The majority of the built-in functions are named after the machine instruction that they generate. For more information on these built-in functions, see the documentation on the corresponding machine instruction. In particular, see that reference for the structure of queue entries manipulated by the queue built-in functions.

Additional Information on:

  • Translation_Macros
  • Intrinsic Functions
  • __ABS
  • __ACQUIRE_SEM_LONG
  • __ADAWI
  • __ADD_ATOMIC_LONG
  • __ADD_ATOMIC_QUAD
  • __ADDF_C
  • __ADDG_C
  • __ADDS_C
  • __ADDT_C
  • __ADDX_C
  • __ALLOCA
  • __AND_ATOMIC_LONG
  • __AND_ATOMIC_QUAD
  • __ATOMIC_ADD_LONG
  • __ATOMIC_ADD_QUAD
  • __ATOMIC_AND_LONG
  • __ATOMIC_AND_QUAD
  • __ATOMIC_OR_LONG
  • __ATOMIC_OR_QUAD
  • __ATOMIC_INCREMENT_LONG
  • __ATOMIC_INCREMENT_QUAD
  • __ATOMIC_DECREMENT_LONG
  • __ATOMIC_DECREMENT_QUAD
  • __ATOMIC_EXCH_LONG
  • __ATOMIC_EXCH_QUAD
  • __CMP_STORE_LONG
  • __CMP_STORE_QUAD
  • __COS
  • __CPYS
  • __CPYSF
  • __CPYSN
  • __CPYSNF
  • __CPYSE
  • __CPYSEF
  • __CVTGF_C
  • __CVTGQ
  • __CVTTQ
  • __CVTTS_C
  • __CVTXQ
  • __CVTXT_C
  • __DIVF_C
  • __DIVG_C
  • __DIVS_C
  • __DIVT_C
  • __DIVX_C
  • __INTERLOCKED_TESTBITCC_QUAD
  • __INTERLOCKED_TESTBITSS_QUAD
  • __FABS
  • __LABS
  • __LOCK_LONG
  • __MB
  • __MEMCPY
  • __MEMMOVE
  • __MEMSET
  • __MULF_C
  • __MULG_C
  • __MULS_C
  • __MULT_C
  • __MULX_C
  • __OR_ATOMIC_LONG
  • __OR_ATOMIC_QUAD
  • __PAL_BPT
  • __PAL_BUGCHK
  • __PAL_CFLUSH
  • __PAL_CHME
  • __PAL_CHMK
  • __PAL_CHMS
  • __PAL_CHMU
  • __PAL_DRAINA
  • __PAL_GENTRAP
  • __PAL__HALT
  • __PAL_INSQHIL
  • __PAL_INSQHILR
  • __PAL_INSQHIQ
  • __PAL_INSQHIQR
  • __PAL_INSQTIL
  • __PAL_INSQTILR
  • __PAL_INSQTIQ
  • __PAL_INSQTIQR
  • __PAL_INSQUEL
  • __PAL_INSQUEL_D
  • __PAL_INSQUEQ
  • __PAL_INSQUEQ_D
  • __PAL_LDQP
  • __PAL_MFPR_XXXX
  • __PAL_MTPR_XXXX
  • __PAL_PROBER
  • __PAL_PROBEW
  • __PAL_RD_PS
  • __PAL_REMQHIL
  • __PAL_REMQHILR
  • __PAL_REMQHIQ
  • __PAL_REMQHIQR
  • __PAL_REMQTIL
  • __PAL_REMQTILR
  • __PAL_REMQTIQ
  • __PAL_REMQTIQR
  • __PAL_REMQUEL
  • __PAL_REMQUEL_D
  • __PAL_REMQUEQ
  • __PAL_REMQUEQ_D
  • __PAL_STQP
  • __PAL_SWPCTX
  • __PAL_SWASTEN
  • __PAL_WR_PS_SW
  • __RELEASE_SEM_LONG
  • __RPCC
  • __SIN
  • __SUBF_C
  • __SUBG_C
  • __SUBS_C
  • __SUBT_C
  • __SUBX_C
  • __TESTBITCCI
  • __TESTBITSSI
  • __TRAPB
  • __UMULH
  • __UNLOCK_LONG
  • VAXC$ESTABLISH

  • Variable_Length_Argument_Lists

    The set of functions and macros defined and declared in the <varargs.h> and the <stdarg.h> header files provide a method of accessing variable-length argument lists. (Note that the <stdarg.h> functions are defined by the ANSI C++ standard and are, therefore, portable as compared with those defined in <varargs.h>.)

    The C++ RTL functions such as printf and execl, for example, use variable-length argument lists. User-defined functions with variable-length argument lists that do not use <varargs.h> or <stdarg.h> are not portable due to the different argument-passing conventions of various machines.

    To use these functions and macros in <stdarg.h>, you must include the <stdarg.h> header file with the following preprocessor directive:

    #include <stdarg.h>

    The <stdarg.h> header file declares a type (va_list) and three macros (va_start, va_arg, and va_end) for advancing through a list of function arguments of varying number and type. The macros have the following syntax:

    void va_start(va_list ap, parmN);

    type va_arg(va_list ap, type);

    void va_end(va_list ap);

    The va_start macro initializes the object ap of type va_list for subsequent use by va_arg and va_end. The va_start macro must be invoked before any access to the unnamed arguments. The parameter parmN is the identifier of the rightmost parameter in the variable parameter list of the function definition. If parmN is declared with the register storage class, with a function or array type, or with a type that is not compatible with the type that results after application of the default arguments promotions, the behavior is undefined. The va_start macro returns no value.

    The va_arg macro expands to an expresion that has the type and value of the next argument in the call. The parameter ap is the same as the one initialized by va_start. Each invocation of va_arg modifies ap so that the values of successive arguments are returned in turn. The parameter "type" is a type name specified such that the type of a pointer to an object that has the specified type can be obtained by postfixing an asterisk (*) to "type". If there is no actual next argument, or if type is not compatible with the type of the next actual argument (as promoted according to the default argument promotions), the behavior is undefined. The first invocation of va_arg after that of va_start returns the value of the argument after that specified by parmN. Successive invocations return the values of the remaining arguments in turn.

    The va_end macro facilitates a normal return from the function whose variable argument list was referred to by the expansion of va_start that initialized the va_list ap object. The va_end macro can modify ap) so that it can no longer be used (without an intervening invocation of va_start). If there is no corresponding invocation of va_start or if va_end is not invoked before the return, the behavior is undefined. The va_end macro returns no value.


    Preprocessor

    The C++ preprocessor uses directives to affect the compilation of a source file. For C++ on OpenVMS systems, these directives are processed by an early phase of the compiler, not by a separate program.

    The preprocessor directives begin with a number sign (#) and do not end with a semicolon. The number sign must appear in the first column of the source line.

    Additional Information on:

  • Null_directive (#)
  • Conditional_Compilation
  • #define
  • #dictionary
  • #error
  • #include
  • #line
  • #module
  • #pragma
  • #undef

  • Predefined_Macros

    The compiler defines the following macros and names. For more detailed information, see Using Compaq C++ for OpenVMS Alpha. The * character following a name indicates that the name cannot be redefined or undefined.

    _BOOL_EXISTS Indicates that bool is a type or keyword

    __BOOL_IS_A_RESERVED_WORD Indicates that bool is a keyword

    __DATE__ * A string literal containing the date of the translation in the form Mmm dd yyyy, or Mmm d yyyy if the value of the date is less than 10

    __FILE__ * A string literal containing the name of the source file being compiled

    __IEEE_FLOAT Identifies floating-point format for compiling the program.

    __LINE__ * A decimal constant containing the current line number in the C++ source file

    __PRAGMA_ENVIRONMENT Indicates that that the pragma environment directive is supported.

    __TIME__ * A string literal containing the time of the translation in the form of hh:mm:ss

    _WCHAR_T Indicates that wchar_t is a keyword

    The following names have a defined value of 1:

    __cplusplus * Language identification name __DECCXX Language identification name __VMS System identification __vms System identification

    For each of the following macros the defined value is a character string representing the operating system version:

    __vms_version __VMS_VERSION

    For each of the following macros the defined value is an unsigned long int that encodes the version number:

    __DECCXX_VER __VMS_VER

    You can use __DECCXX_VER to test that the current compiler version is newer than a particular version and __VMS_VER to test that the current OpenVMS version is newer than a particular version. Newer versions of the compiler and OpenVMS have larger values for these macros. If the compiler cannot analyze the version, the corresponding macro has a defined value of 0. These macros are not defined for releases of C++ prior to Version 5.0.

    C++ for OpenVMS Alpha Systems also supports the following predefined system identification macro names in all compiler modes:

    __Alpha_AXP __alpha __ALPHA __32BITS __INITIAL_POINTER_SIZE

    C++ predefines __32BITS when pointers and data of type long are 32 bits.

    For code that is intended to be portable from one system to another, users of both OpenVMS and Tru64 UNIX operating systems should use __alpha.

    Predefined macros (with the exception of vms_version, VMS_VERSION, __vms_version, __VMS_VERSION, and __INITIAL_POINTER_SIZE) are defined as 1 or 0, depending on the system (VAX or Alpha processor), the compiler defaults, and the qualifiers used. For example, if you compiled using G_FLOAT format, __D_FLOAT and __IEEE_FLOAT (Alpha processors only) are predefined to be 0, and __G_FLOAT is predefined as if the following were included before every compilation unit:

    #define __G_FLOAT 1

    These macros can assist in writing code that executes conditionally. They can be used in #elif, #if, #ifdef, and #ifndef directives to separate portable and nonportable code in a C++ program. The vms_version, VMS_VERSION, __vms_version, and __VMS_VERSION macros are defined with the value of the OpenVMS version on which you are running (for example, Version 6.0).

    C++ automatically defines the following predefined macros pertaining to the format of floating-point variables. You can use them to identify the format with which you are compiling your program.

    __D_FLOAT __G_FLOAT __IEEE_FLOAT __IEEE_FP __X_FLOAT

    The value of __X_FLOAT can be 0 or 1 depending on the floating point mode in effect. You can use the /FLOAT qualifier to change the mode.

    C++ automatically defines the following macros when the corresponding command-qualifier is used:

    Command-line Option Macro Name ------------------- ---------- /ASSUME=GLOBAL_ARRAY_NEW __GLOBAL_ARRAY_NEW /ASSUME=STDNEW __STDNEW /DEFINE=__FORCE_INSTANTATIONS __FORCE_INSTANTIATIONS /EXCEPTIONS __EXCEPTIONS /IEEE_MODE __IEEE_FP /IMPLICIT_INCLUDE __IMPLICIT_INCLUDE_ENABLED /ROUNDING_MODE __BIASED_FLT_ROUNDS /RTTI __RTTI /STDNEW __STDNEW /STANDARD=ANSI __STD_ANSI, __NO_USE_STD_IOSTREAM /STANDARD=ARM __STD_ARM, __NO_USE_STD_IOSTREAM /STANDARD=CFRONT __STD_CFRONT, __NO_USE_STD_IOSTREAM /STANDARD=GNU __STD_GNU, __NO_USE_STD_IOSTREAM /STANDARD=MS __STD_MS, __NO_USE_STD_IOSTREAM /STANDARD=STRICT_ANSI __STD_STRICT_ANSI, __USE_STD_IOSTREAM /STANDARD=STRICT_ANSI /WARNINGS=ANSI_ERRORS __STD_STRICT_ANSI_ERRORS, __USE_STD_IOSTREAM /USING=STD __IMPLICIT_USING_STD

      

    1.800.AT.COMPAQ

    privacy and legal statement