Predefined Macro Use
The macros listed in this chapter are the Cray-specific predefined macros. To see the entire list of predefined macros, add -Wp,-list_final_macros to the cc command line.
The macros listed in this chapter are the Cray-specific predefined macros. To see the entire list of predefined macros, add -Wp,-list_final_macros to the cc command line. For example, if it is the file c.c, specify:
% cc -Wp,-list_final_macros c.c > outPredefined macros provide information about the compilation environment. In this chapter, only those macros that begin with the underscore (_) character are defined when running in strict-conformance mode.
Any of the predefined macros except those required by the standard can be undefined by using the -U command line option; they can also be redefined by using the -D command line option.
A large set of macros is also defined in the standard header files.
Macros Required by the C and C++ Standards
The following macros are required by C and C++ standards:
- __TIME__
- Time of translation of the source file.
- __DATE__
- Date of translation of the source file.
- __LINE__
- Line number of the current line in the source file.
- __FILE__
- Name of the source file being compiled.
- __STDC__
- Defined as the decimal constant 1 if compilation is in strict conformance mode; defined as the decimal constant 2 if the compilation is in extended mode. This macro is defined for Cray C and C++ compilations.
- __cplusplus
- Defined as 1 when the compiling Cray C++ code and undefined when compiling Cray C code. The __cplusplus macro is required by the ISO C++ standard, but not the ISO C standard.
Macros Based on the Host Machine
The following macros provide information about the environment running on the host machine:
- __linux
- Defined as 1.
- __linux__
- Defined as 1.
- linux
- Defined as 1.
- __gnu_linux__
- Defined as 1.
Macros Based on the Target Machine
The following macros provide information about the characteristics of the target machine:
| Macro | x86 | AVX |
|---|---|---|
| _ADDR64 | Defined as 1 if the targeted CPU has 64-bit address registers; if the targeted CPU does not have 64-bit address registers, the macro is not defined. | |
| __LITTLE_ENDIAN__ | Defined as 1. | |
| _LITTLE_ENDIAN | Defined as 1. | |
| _MAXVL_8 | Defined as 16, the number of 8-bit elements that fit in an XMM register ("vector length"). | Defined as 32, the number of 8-bit elements that fit in a YMM register ("vector length"). |
| _MAXVL_16 | Defined as 8. | Defined as 16. |
| _MAXVL_32 | Defined as 4. | Defined as 8. |
| _MAXVL_64 | Defined as 2. | Defined as 4. |
| _MAXVL_128 | Defined as 0. | Defined as 2. |
Macros Based on the Compiler
The following macros provide information about compiler features:
- _RELEASE_MAJOR
- Defined as the major release level of the compiler.
- _RELEASE_MINOR
- Defined as the minor release level of the compiler.
- _RELEASE_STRING
- Defined as a string that describes the version of the compiler.
- _CRAYC
- Defined as 1 to identify the Cray C and C++ compilers.
UPC Predefined Macros
The following macros provide information about UPC functions:
- __UPC__
- The integer constant 1, indicating a conforming implementation.
- __UPC_DYNAMIC_THREADS__
- The integer constant 1 in the dynamic THREADS translation environment.
- __UPC_STATIC_THREADS__
- The integer constant 1 in the static THREADS translation environment.