Menu

Compilers

There is a newer version of this page. You can find it here.

Please send updates/corrections to predef-contribute.

ACC

Type Macro
Identification _ACC_

Altium MicroBlaze C

Type Macro Format Description
Identification __CMB__
Version __VERSION__ VRRR V=Version
RRR=Revision
Version __REVISION__ P P=Patch
Version __BUILD__ VRRRPPP Build number
Example
Altium MicroBlaze C __VERSION__ __REVISION__ __BUILD__
1.0r2 1000 2
1.22.2 1022001

Altium C-to-Hardware

Type Macro Format Description
Identification __CHC__
Version __VERSION__ VRRR V=Version
RRR=Revision
Version __REVISION__ P P=Patch
Beta releases set this to -1
Version __BUILD__ VRRRPPP Build number
Example
Altium C-to-Hardware __VERSION__ __REVISION__ __BUILD__
2.1r1 2001 1
1.22.2 1022001

Amsterdam Compiler Kit

Type Macro
Identification __ACK__

ARM Compiler

Type Macro Format Description
Identification __CC_ARM
Version __ARMCC_VERSION VRPBBB V = Version
R = Revision
P = Patch
BBB = Build

Notice that the __ARMCC_VERSION macro is also used as version indicator for Norcroft C, but that the format is different.

Example
Realview C __ARMCC_VERSION
3.0 300503

Aztec C

Type Macro Format Description
Identification AZTEC_C
__AZTEC_C__
Version __VERSION VRR V = Version
RR = Revision
Example
Aztec C __VERSION
5.20 520

Borland C++

Type Macro Format
Identification __BORLANDC__
Version __BORLANDC__ ?
Identification __CODEGEARC__
Version __CODEGEARC__ ?
Example
Borland C++ C++ Builder __BORLANDC__ __CODEGEARC__
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
5.6.4 0x562
2009 0x613 0x613
2010 0x621 0x621

CC65

Type Macro Format Description
Identification __CC65__
Version __CC65__ 0xVRP V = Version
R = Revision
P = Patch
Example
Version __CC65__
2.10.1 0x2A1

Clang

Type Macro Format
Identification __clang__
Version __clang_major__ Version
Version __clang_minor__ Revision
Version __clang_patchlevel__ Patch

Notice that clang also defines the GNU C version macros, but you should use the clang feature checking macros to detect the availability of various features.

Comeau C++

Type Macro Format Description
Identification __COMO__
Version __COMO_VERSION__ VRR V = Version
RR = Revision
Example
Comeau C++ __COMO_VERSION__
2.3 230

Compaq C/C++

Type Macro Format Description
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
Example
Compaq C/C++ __DECC_VER
6.0-001 60090001

Convex C

Type Macro
Identification __convexc__

Cray C

Type Macro Description
Identification _CRAYC
Version _RELEASE Version
Version _RELEASE_MINOR Revision

Diab C/C++

Type Macro Format Description
Identification __DCC__ 1
Version __VERSION_NUMBER__ VRPP V = Version
R = Revision
PP = Patch
Example
Diab C/C++ __VERSION_NUMBER__
4.4g 4426

DICE C

Type Macro
Identification _DICE

Digital Mars

Type Macro Format Description
Identification __DMC__
Version __DMC__ 0xVRP V = Version
R = Revision
P = Patch
Example
Digital Mars __DMC__
7.0 0x700
7.2 0x720
8.0 0x800

Dignus Systems/C++

Type Macro Format Description
Identification __SYSC__
Version __SYSC_VER__ VRRPP V = Version
RR = Revision
PP = Patch
Example
Systems/C __SYSC_VER__
1.80.32 18032

DJGPP

Type Macro Description
Identification __DJGPP__
Version __DJGPP__ Version
Version __DJGPP_MINOR__ Revision
Identification __GO32__ Defined by DJGPP 1.x
Example
DJGPP __DJGPP__ __DJGPP_MINOR__
2.01 2 1

EKOPath

Type Macro Description
Identification __PATHCC__
Version __PATHCC__ Version
Version __PATHCC_MINOR__ Revision
Version __PATHCC_PATCHLEVEL__ Patch
Example
EKOPath __PATHCC__ __PATHCC_MINOR__ __PATHCC_PATCHLEVEL__
2.0 2 0 0

EDG C++ Frontend

Type Macro Format Description
Identification __EDG__
Version __EDG_VERSION__ VRR V = Version
RR = Revision
Example
EDG C++ __EDG_VERSION__
2.30 230

GCC C/C++

Type Macro Description
Identification __GNUC__
Version __GNUC__ Version
Version __GNUC_MINOR__ Revision
Version __GNUC_PATCHLEVEL__ Patch (introduced in version 3.0)

Notice that the meaning of the __GNUC__ macro has changed subtly over the years, from identifying the GNU C/C++ compiler to identifying any compiler that implements the GNU compiler extensions (see the Feature request - a macro defined for GCC discussion for further information). For example, the Intel C++ on Linux also defines these macros from version 8.1 (see the Intel C++ Compiler 8.1 for Linux Release Notes and Intel Compilers for Linux: Compatibility with GNU Compilers.)

Example
GNU C/C++ __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__
2.7.x 2 7 N/A
3.0.2 3 0 2

Alternative Version

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:

Type Macro Format Description
Version __GNUC_VERSION__ VVRRPP VV = Version
RR = Revision
PP = Patch
Example of Alternative Version
GNU C/C++ __GNUC_VERSION__
2.7.x 20700
3.0.2 30002

Green Hill C/C++

Type Macro Format Description
Identification __ghs__
Version __GHS_VERSION_NUMBER__ VRP V = Version
R = Revision
P = Patch
Version __GHS_REVISION_DATE__ Epoch time
Example
Green Hill C/C++ __GHS_VERSION_NUMBER__
4.2.1 421

HP ANSI C

Type Macro
Identification __HP_cc

HP aC++

Type Macro Format Description
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)
Example
HP aCC __HP_aCC
A.01.21 012100

MongoDB Logo MongoDB