Macros to identify the compiler
Most of the macros related to the Open XL C/C++ compiler are predefined and protected, which means that the compiler issues a warning message if you try to undefine or redefine them. You can use these macros to distinguish code consumed by Open XL C/C++ from code consumed by other compilers in your programs.
You can use the -dM -E option on an empty source file to view the values of the predefined macros.
| Predefined macro name | Description | Predefined value |
|---|---|---|
| __clang__ | Indicates that the Clang front end is used. | 1 |
| __clang_major__ | Indicates the major version number of the Clang front end on which Open XL C/C++ is based. | 14 |
| __clang_minor__ | Indicates the minor version number of the Clang front end on which Open XL C/C++ is based. | 0 |
| __clang_patchlevel__ | Indicates the patch level number of the Clang front end on which Open XL C/C++ is based. | 0 |
| __clang_version__ | Indicates the full version of the Clang front end on which Open XL C/C++ is based. | "14.0.0 " |
| __llvm__ | Indicates than an LLVM-based derivative compiler is being used. | 1 |
| __open_xl__ | Indicates the Open XL C/C++ compiler is being used. | 1 |
| __open_xl_modification__ | Indicates the modification number of the Open XL C/C++ compiler. | 0 |
| __open_xl_ptf_fix_level__ | Indicates the PTF fix level of the Open XL C/C++ compiler. | 0 |
| __open_xl_release__ | Indicates the release number of the Open XL C/C++ compiler. | 1 |
| __open_xl_ver__ | Compares against __open_xl_vrm__. |
Typical usage:
|
| __open_xl_version__ | Indicates the version number of the Open XL C/C++ compiler. | 1 |
| __open_xl_vrm__ | Indicates the VRM level of the Open XL C/C++ compiler using a single integer for ordering. | 0x01010000u |
| __COMPILER_VER__ | A number that identifies the compiler, which is different from the z/OS® XL C/C++ compiler. | 0x50000000 Note: The predefined value does not follow the same
version naming format of z/OS XL C/C++ and does
not represent a specific compiler version.
|
| __VERSION__ | The version of the Open XL C/C++ compiler that is represented as a string. | "IBM Open XL C/C++ 1.1 for z/OS, (5650-ZOS), Clang 14.0.0" |
Use macros that are related to a feature or the __has_feature() and __has_attribute() macros for conditional compilation rather than using the compiler related macros in the table.