System_Identification_Macros
The following macros have a defined value of 1 in DIGITAL C++:
__cplusplus
__DECCXX
__vms
__VMS
For each of the following macros the defined value is a character
string representing the operating system version:
__vms_version
__VMS_VERSION
Version_Number_Macros
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 DIGITAL C++ prior to Version 5.0.
Alpha_System_Macros
DIGITAL 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
DIGITAL 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 Digital 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_floating format, then __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 DIGITAL 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).
Floating_Point_Macros
DIGITAL 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
You can use the /FLOAT command qualifier to change the mode.
Implementation_Compatibility_Macros
DIGITAL C++ automatically defines the following macros when the
corresponding command-qualifier is used:
Command-line Option Macro Name
------------------- ----------
/IMPLICIT_INCLUDE __IMPLICIT_INCLUDE_ENABLED
/GLOBAL_ARRAY_NEW __GLOBAL_ARRAY_NEW
/PCH,/CREATE_PCH,/USE_PCH __PCH_ENABLED
/STDNEW __STDNEW
/STANDARD=ANSI __ANSI
/STANDARD=ARM __ARM
/STANDARD=CFRONT __CFRONT
/STANDARD=MS __MS
/STANDARD=STRICT_ANSI __STRICT_ANSI
_BOOL_EXISTS
Indicates that bool is a keyword.
CC$gfloat
When you compile using the /G_FLOAT qualifier, CC$gfloat is defined
as 1. When you compile without the /G_FLOAT qualifier, CC$gfloat
is defined as 0. The CC$gfloat macro is provided for compatiblity
with VAX C. The __G_FLOAT predefined macro should be used instead.
__DATE__
The __DATE__ macro evaluates to a string specifying the date on
which the compilation started. The string presents the date in the
form "Mmm dd yyyy" The names of the months are those generated by
the asctime library function. The first d is a space if dd is less
than 10.
Example:
printf("%s",__DATE__);
__FILE__
The __FILE__ macro evaluates to a string literal specifying the
file specification of the current source file.
Example:
printf("file %s", __FILE__);
__LINE__
The __LINE__ macro evaluates to a decimal constant specifying the
number of the line in the source file containing the macro
reference.
Example:
printf("At line %d in file %s", __LINE__, __FILE__);
__TIME__
The __TIME__ macro evaluates to a string specifying the time that
the compilation started. The time has the following format:
hh:mm:ss
Example:
printf("%s", __TIME__);
The value of this macro remains constant throughout the translation
unit.
_WCHAR_T
Indicates that wchar_t is a keyword.