Macros to identify the XL C/C++ compiler
Most of the macros related to the XL C/C++ compiler are predefined and protected, which means that the compiler will issue a warning if you try to undefine or redefine them. You can use these macros to distinguish code consumed by XL C/C++ from code consumed by other compilers in your programs.
You can use the -qshowmacros=pre
-E compiler options to view the values of the predefined macros. 
You can use -qshowmacros
-E on an empty source file to view the values of the predefined macros.
| Predefined macro name | Description | Predefined value |
|---|---|---|
__IBMC__ |
Indicates the level of the XL C compiler. | An integer in format VRM, where:
|
__IBMCPP__ |
Indicates the level of the XL C++ compiler. | An integer in format VRM, where:
|
__xlc__ |
Indicates the level of the XL C compiler. | A string in format V.R.M.F, where:
|
| __xlC__ | Indicates the VR level of the XL C and XL C++ compilers in hexadecimal format. | A 4-digit hexadecimal integer in format 0xVVRR,
where:
|
| __xlC_ver__ | Indicates the MF level of the XL C and XL C++ compilers in hexadecimal format. | An 8-digit hexadecimal integer in format
0x0000MMFF, where:
For example, in PTF 3, the value of the macro is 0x00000003. |
| Predefined macro name | Description | Predefined value |
|---|---|---|
| __ibmxl__ | Indicates the XL C/C++ compiler is being used. | 1 |
| __ibmxl_vrm__ | Indicates the VRM level of the XL C/C++ compiler using a single integer for sorting purposes. | A hexadecimal integer whose value is as follows:
|
| __ibmxl_version__ | Indicates the version number of the XL C/C++ compiler. | An integer that represents the version number |
| __ibmxl_release__ | Indicates the release number of the XL C/C++ compiler. | An integer that represents the release number |
| __ibmxl_modification__ | Indicates the modification number of the XL C/C++ compiler. | An integer that represents the modification number |
| __ibmxl_ptf_fix_level__ | Indicates the PTF fix level of the XL C/C++ compiler. | An integer that represents the fix number |
| __clang__ | Indicates that Clang front end is used. | 1 |
| __clang_major__ | Indicates the major version number of the Clang front end. | 4 |
| __clang_minor__ | Indicates the minor version number of the Clang front end. | 0 |
| __clang_patchlevel__ | Indicates the patch level number of the Clang front end. | 1 |
| __clang_version__ | Indicates the full version of the Clang front end. | 4.0.1 (tags/RELEASE_401/final) |
|
Note:
In addition to the predefined macros for xlclang/xlclang++, you can specify -qxlcompatmacros to also define the five legacy macros listed in Table 1. This is useful when you migrate programs from IBM XL C/C++ for AIX, V13.1.3 or earlier releases to IBM XL C/C++ for AIX 16.1 that is invoked by xlclang or xlclang++. |
||
__IBMC__
__IBMCPP__