DIGITAL logo   C++ Graphic
    Updated: 21 November 1998
  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 very efficient because they are built into the DIGITAL 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.

DIGITAL 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 DIGITAL C++ preprocessor uses directives to affect the compilation of a source file. For DIGITAL 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

    DIGITAL C++ provides the following predefined macros:

    Additional Information on:

  • System_Identification_Macros
  • Version_Number_Macros
  • Alpha_System_Macros
  • Floating_Point_Macros
  • Implementation_Compatibility_Macros
  • _BOOL_EXISTS
  • CC$gfloat
  • __DATE__
  • __FILE__
  • __LINE__
  • __TIME__
  • _WCHAR_T

  •    
    Burgundy bar
    DIGITAL Home Feedback Search Sitemap Subscribe Help
    Legal