Most compilers defines macros to indicate the compiler and its version. These are useful to avoid bugs in certain compiler versions, or to check for the existance of certain features.
Identification | __TURBOC__ | . |
Version | __TURBOC__ | ? |
2.0 | 397 |
3.0 | 661 |
Official site | Wikipedia |
Identification | __BORLANDC__ | . |
Version | __BORLANDC__ | ? |
2.0 | . | 0x200 |
3.0 | . | 0x400 |
3.1 | . | 0x410 |
4.0 | . | 0x452 |
5.0 | . | 0x500 |
5.02 | 1.0 | 0x520 |
. | 3.0 | 0x530 |
. | 4.0 | 0x540 |
5.5 | 5.0 | 0x550 |
5.51 | . | 0x551 |
Official site | Google Directory | Wikipedia |
Identification | __COMO__ | . | . |
Version | __COMO_VERSION__ | VRR | V = Version RR = Revision |
2.3 | 230 |
Identification | __DECC | . | C compiler |
Version | __DECC_VER | VVRRTPPPP | VV = Version RR = Revision T = Type (9 = official) PPPP = Patch |
Identification | __DECCXX | . | C++ compiler |
Version | __DECCXX_VER | As __DECC_VER | . |
Identification | __VAXC | . | Obsolete |
Identification | VAXC | . | Obsolete |
6.0-001 | 60090001 |
Identification | _CRAYC | . |
Version | _RELEASE | Version |
Version | _RELEASE_MINOR | Revision |
Identification | __CYGWIN__ |
Official site | Wikipedia |
Identification | __DCC__ | 1 | . |
Version | __VERSION_NUMBER__ | VRPP | V = Version R = Revision PP = Patch |
4.4g | 4426 |
Identification | __DMC__ | . | . |
Identification | __SC__ | . | Obsolete |
Identification | __ZTC__ | . | Obsolete |
Version | __DMC__ | 0xVRP | V = Version R = Revision PP = Patch |
7.0 | 0x700 |
7.2 | 0x720 |
8.0 | 0x800 |
Identification | __DJGPP__ | . |
Version | __DJGPP__ | Version |
Version | __DJGPP_MINOR__ | Revision |
Identification | __GO32__ | Defined by DJGPP 1.x |
2.01 | 2 | 1 |
Official site | Google Directory | Wikipedia |
Identification | __PATHCC__ | . |
Version | __PATHCC__ | Version |
Version | __PATHCC_MINOR__ | Revision |
Version | __PATHCC_PATCHLEVEL__ | Patch |
2.0 | 2 | 0 | 0 |
Identification | __EDG__ | . | . |
Version | __EDG_VERSION__ | VRR | V = Version RR = Revision |
2.30 | 230 |
Identification | __GNUC__ | . |
Version | __GNUC__ | Version |
Version | __GNUC_MINOR__ | Revision |
Version | __GNUC_PATCHLEVEL__ | Patch (introduced in version 3.0) |
2.7.x | 2 | 7 | . |
3.0.2 | 3 | 0 | 2 |
If you prefer a single version macro, you can define the following yourself.
#if defined(__GNUC__) # if defined(__GNUC_PATCHLEVEL__) # define __GNUC_VERSION__ (__GNUC__ * 10000 / + __GNUC_MINOR__ * 100 / + __GNUC_PATCHLEVEL__) # else # define __GNUC_VERSION__ (__GNUC__ * 10000 / + __GNUC_MINOR__ * 100) # endif #endif
The format of this new macro is:
Version | __GNUC_VERSION__ | VVRRPP | VV = Version RR = Revision PP = Patch |
2.7.x | 20700 |
3.0.2 | 30002 |
Official site | Google Directory | Wikipedia |
Identification | __ghs__ | . | . |
Version | __GHS_VERSION_NUMBER__ | VRP | V = Version R = Revision P = Patch |
Version | __GHS_REVISION_DATE__ | Epoch time | . |
4.2.1 | 421 |
Official site | Wikipedia |
Identification | __HP_cc |
Identification | __HP_aCC | . | . |
Version | __HP_aCC | 1 | From version A.01.15 (and A.03.13) |
Version | __HP_aCC | VVRRPP | VV = Version RR = Revision PP = Patch From version A.01.21 (and A.03.25) |
A.01.21 | 012100 |
Identification | __xlC__ | . | . |
Version | __xlC__ | 0xVVRR | VV = Version RR = Revision |
Identification | __IBMC__ | . | From ? |
Identification | __IBMCPP__ | . | From ? |
Version | __IBMC__ __IBMCPP__ |
VRP | V = Version R = Revision P = Patch |
Please note that the z/OS C/C++ compiler also defines __IBMC__
and __IBMCPP__
macros, but with a different syntax. See the entry on the z/OS C/C++ compiler below for further information.
3.1 | 0x0301 | . |
4.5 | 0x0405 | 450 |
5.0 | 0x0500 | 500 |
Official site | Wikipedia |
This is the XL C/C++ compiler for mainframes (e.g. z/OS). The entry on XL C/C++ has been split into two for clarity.
Identification | __IBMC__ | . | . |
Identification | __IBMCPP__ | . | . |
Version | __IBMC__ __IBMCPP__ |
NVRRM | N = Product (0 = C/370, 1 = MVS, 2 = OS/390, 4 = z/OS) V = Version RR = Revision P = Patch Defined for z/OS XL C/C++ |
Version | __COMPILER_VER__ | 0xNVRRPPPP | N = Product (see above) V = Version RR = Revision PPPP = Patch Defined for z/OS XL C/C++ |
Please note that XL C/C++ also defines __IBMC__
and __IBMCPP__
macros, but with a different syntax. You can use __xlC__
(only defined for XL C/C++) or __COMPILER_VER__
(only defined for z/OS C/C++) to distinguish between the two.
#if defined(__IBMC__) || defined(__IBMCPP__) # if defined(__COMPILER_VER__) /* z/OS C/C++ so __IBMC__ is defined as NVRRM */ # else /* XL C/C++ so __IBMC__ is defined as VRP */ # endif #endif
1.7 | 41070 | 0x41070000 |
Official site | Wikipedia |
Identification | __IAR_SYSTEMS_ICC__ | . | . |
Version | __VER__ | VRR | V = Version RR = Revision |
3.34 | 334 |
Identification | __INTEL_COMPILER | . | . |
Identification | __ICC | . | Obsolete |
Identification | __ECC | . | Obsolete |
Identification | __ICL | . | . |
Version | __INTEL_COMPILER | VRP | V = Version R = Revision P = Patch |
Version | __INTEL_COMPILER_BUILD_DATE | YYYYMMDD | YYYY = Year MM = Month DD = Day |
5.0 | 500 | . |
6.0 | 600 | . |
8.0 | 800 | . |
9.0 | 900 | 20060222 |
Identification | __KCC | . | . |
Version | __KCC_VERSION | 0xVRPP | V = Version R = Revision PP = Patch (a = 01, b = 02, ...) |
4.0d | 4004 |
Identification | __CA__ | . | . |
Identification | __KEIL__ | . | . |
Version | __CA__ | VRR | V = Version R = Revision |
1.01 | 101 |
Identification | __C166__ | . | . |
Version | __C166__ | VRR | V = Version R = Revision |
5.01 | 501 |
Identification | __C51__ | . | . |
Identification | __CX51__ | . | . |
Version | __C51__ | VRR | V = Version R = Revision |
7.01 | 701 |
Identification | __LCC__ |
Official site | Wikipedia |
Identification | __llvm__ |
Official site | Wikipedia |
Identification | __HIGHC__ |
Identification | __MWERKS__ | . | . |
Version | __MWERKS__ | 1 | Until CodeWarrior 7 |
Version | __MWERKS__ | 0xVRPP | V = Version R = Revision PP = Patch From CodeWarrior 7 |
2.0 | 0x2000 |
2.2 | 0x2200 |
Official site | Wikipedia |
Identification | __MINGW32__ | . |
Version | __MINGW32_MAJOR_VERSION | Version |
Version | __MINGW32_MINOR_VERSION | Revision |
2.4 | 2 | 4 |
Official site | Wikipedia |
Identification | __sgi | . | . |
Identification | sgi | . | . |
Version | _COMPILER_VERSION | VRP | V = Version R = Revision P = Patch Until ? |
Version | _SGI_COMPILER_VERSION | VRP | V = Version R = Revision P = Patch From ? |
6.0.2 | 602 | . |
7.2.1 | 721 | . |
7.4.4 | . | 744 |
Identification | __MRC__ | . | . |
Identification | MPW_C | . | . |
Identification | MPW_CPLUS | . | . |
Version | __MRC__ | 0xVVRR | VV = Version RR = Revision |
5.0 | 0x500 |
Identification | _MSC_VER | . | . |
Version | _MSC_VER | VVRR | VV = Version RR = Revision |
Version | _MSC_FULL_VER | VVRRPPPP | VV = Version RR = Revision PPPP = Patch From ? |
Version | _MSC_FULL_VER | VVRRPPPPP | VV = Version RR = Revision PPPPP = Patch From ? |
Please note that _MSC_FULL_VER
is not officially documented by the vendor.
1.0 | 800 | . |
3.0 | 900 | . |
4.0 | 1000 | . |
4.2 | 1020 | . |
5.0 | 1100 | . |
6.0 | 1200 | . |
6.0 SP6 | 1200 | 12008804 |
7.0 | 1300 | 13009466 |
7.1 (2003) | 1310 | 13103077 |
8.0 (2005) | 1400 | 140050727 |
Official site | Google Directory | Wikipedia |
Identification | _MRI |
Identification | __CC_NORCROFT | . | . |
Version | __ARMCC_VERSION | V.R | V = Version R = Revision |
Please note that __ARMCC_VERSION
is assigned a floating-point number, so it cannot be used by the preprocessor to compare versions.
4.69 | 4.69 |
4.90 | 4.90 |
Identification | __PACIFIC__ |
Identification | _PACC_VER | . | . |
Version | _PACC_VER | 0xVRRPPBBB | V = Version RR = Revision PP = Patch BBB = Build |
1.0.0.13 | 0x1000000D |
Official site | Google Directory |
Identification | __POCC__ | . | . |
Version | __POCC__ | VRR | V = Version RR = Revision |
3.00 | 300 |
Identification | __PGI |
Identification | __CC_ARM | . | . |
Version | __ARMCC_VERSION | VRPBBB | V = Version R = Revision P = Patch BBB = Build |
Please note that the __ARMCC_VERSION
macro is also used as version indicator for Norcroft C, but that the format is different.
3.0 | 300503 |
Identification | SASC | . | . |
Identification | __SASC | . | . |
Identification | __SASC__ | . | . |
Version | __VERSION__ | . | Until ? |
Version | __REVISION__ | . | Until ? |
Version | __SASC__ | VRR | V = Version RR = Revision From ? |
5.10 | . | 5 | 10 |
6.50 | 650 | . | . |
Identification | _SCO_DS |
Identification | SDCC | . | . |
Version | SDCC | VRP | V = Version R = Revision P = Patch |
2.5.6 | 256 |
Official site | Google Directory | Wikipedia |
Identification | __SUNPRO_C | . | C compiler |
Version | __SUNPRO_C | 0xVRP | V = Version R = Revision P = Patch |
Identification | __SUNPRO_CC | . | C++ compiler |
Version | __SUNPRO_CC | As __SUNPRO_C | . |
4.2 | 0x420 |
5.0 | 0x500 |
Identification | __SYSC__ | . | C compiler |
Version | __SYSC_VER__ | VRRPP | V = Version RR = Revision PP = Patch |
1.80.32 | 18032 |
Identification | __TenDRA__ |
Official site | Wikipedia |
Identification | __TINYC__ |
Identification | _UCC | . |
Version | _MAJOR_REV = V _MINOR_REV = R |
V = Version R = Revision |
2.1 | 2 | 1 |
Identification | __USLC__ | . | . |
Version | __SCO_VERSION | 0xVRRYYYYMM | V = Version RR = Revision YYYY = Year MM = Month |
3.2 | 302199801 |
Identification | __WATCOMC__ | . | . |
Version | __WATCOMC__ | VVRR | VV = Version RR = Revision |
10.5 | 1050 |
11.0 | 1100 |
Official site | Wikipedia |