|
VMS Help CXX, Language Topics, Predefined Macros *Conan The Librarian |
The compiler defines the following macros and names. For more
detailed information, see the HP C++ User's Guide for OpenVMS
Systems. The * character following a name indicates that the name
cannot be redefined or undefined.
Macro Description
_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. The value is always
1 for HP Tru64 UNIX.
__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 table lists names with a defined value of 1.
Name Description
__cplusplus Language identification name.
__DECCXX Language identification name.
__VMS System identification
__vms System identification
The compiler predefines __VMS; the C compiler predefines VMS and
__VMS. Therefore, C++ programmers who plan to reuse code should
check for __VMS.
The compiler supports the following predefined macro names:
Name Description
__Alpha_AXP System identification name
__ALPHA System identification name
__alpha System identification name
__32BITS Defined when pointers and data of type long
are 32 bits on Alpha platforms
The compiler predefines __32BITS when pointers and data of type
long are 32 bits on Alpha platforms.
On both UNIX and OpenVMS Alpha operating systems, programmers
should use the predefined macro __alpha for code that is intended
to be portable from one system to the other.
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 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.
The following table lists predefined version string and version
number macros.
Name Description
__VMS_VERSION Version identification
__vms_version Version identification
__DECCXX_VER Version identification
__VMS_VER Version identification
For example, the defined value of __VMS_VERSION on OpenVMS
Version 6.1 is character string V6.1.
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 the Openvms operating
system always have larger values for these macros. If for any
reason the version cannot be analyzed by the compiler, then the
corresponding predefined macro is defined but has the value of
0. Releases of the compiler prior to Version 5.0 do not define
these macros, so you can distinguish earlier compiler versions by
checking to determine if the __DECCXX_VER macro is defined.
The following example tests for C++ 5.1 or higher:
#ifdef __DECCXX_VER
#if __DECCXX_VER >= 50100000
/ *Code */
#endif
#endif
The following tests for OpenVMS Version 6.2 or higher:
#ifdef __VMS_VER
#if __VMS_VER >= 60200000
/* code */
#endif
#endif
The following table shows the macro names for the listed command-
line qualifiers.
Command-line Option Macro Name
/ASSUME=GLOBAL_ARRAY_NEW __GLOBAL_ARRAY_NEW
/ASSUME=STDNEW __STDNEW
/DEFINE=__FORCE_ __FORCE_INSTANTIATIONS
INSTANTATIONS
/EXCEPTIONS __EXCEPTIONS
/IEEE_MODE _IEEE_FP
/IMPLICIT_INCLUDE __IMPLICIT_INCLUDE_ENABLED
/L_DOUBLE_SIZE __X_FLOAT
/MODEL=ANSI __MODEL_ANSI
/MODEL=ARM __MODEL_ARM
/PURE_CNAME __PURE_CNAME, __HIDE_FORBIDDEN_NAMES
/ROUNDING_MODE __BIASED_FLT_ROUNDS
/RTTI __RTTI
/STANDARD=RELAXED __STD_ANSI, __NOUSE_STD_IOSTREAM
/STANDARD=ANSI __STD_ANSI, __NOUSE_STD_IOSTREAM
/STANDARD=ARM __STD_ARM, __NOUSE_STD_IOSTREAM
/STANDARD=GNU __STD_GNU, __NOUSE_STD_IOSTREAM
/STANDARD=MS __STD_MS, __NOUSE_STD_IOSTREAM
/STANDARD=STRICT_ANSI __STD_STRICT_ANSI,
__USE_STD_IOSTREAM, __PURE_CNAME
__HIDE_FORBIDDEN_NAMES
/STANDARD=STRICT_ANSI __STD_STRICT_ANSI_ERRORS
/WARNINGS=ANSI_ERRORS
__PURE_CNAME, __HIDE_FORBIDDEN_NAMES
/STANDARD=LATEST __STD_STRICT_ANSI,
__USE_STD_IOSTREAM, __PURE_CNAME
__HIDE_FORBIDDEN_NAMES
/STANDARD=LATEST __STD_STRICT_ANSI_ERRORS
/WARNINGS=ANSI_ERRORS
__PURE_CNAME, __HIDE_FORBIDDEN_NAMES
/USING=STD __IMPLICIT_USING_STD
|
|