Predefined macros in C/C++ that tell you what the compiler is.

These are the predefined macros that C/C++ compilers define to tell you what compiler is being used. There are also predefined macros in C/C++ that tell you the platform, predefined macros in C/C++ that tell you the target processor and predefined macros in C/C++ that tell you what language features are available.

Compiler Macro Notes
Compiler Macro Notes
Metaware High C++ __HIGHC__
OpenWatcom __WATCOMC__ encodes the major version, minor version, and revision numbers in decimal (1210 for Watcom version 12.1.0. a.k.a. OpenWatcom 1.1, for example)
__WATCOM_CPLUSPLUS__ C++ language only, value identical to __WATCOMC__
IBM VAC++ __IBMC__ C language only
__IBMCPP__ C++ language only
DigitalMars __DMC__ encodes the version number in hexadecimal as three nybbles: major, minor, and revision (0x720 for version 7.2.0, for example)
Borland C++ __BCPLUSPLUS__ C++ language only
__BORLANDC
MSVC++ _MSC_VER encodes the major version, minor version, and revision numbers in decimal (1310 for version 13.1.0, for example)
GCC __GNUC__ defined to the major version number (minor version number in __GNUC_MINOR__ and revision in __GNUC_PATCHLEVEL__)
Clang __clang__

© Copyright 2012 Jonathan de Boyne Pollard. "Moral" rights asserted.
Permission is hereby granted to copy and to distribute this web page in its original, unmodified form as long as its last modification datestamp information is preserved.