`

macros to indicate the compiler and its version

 
阅读更多

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.

Table of Content - Compilers

Borland Turbo C

Type Macro Format
Identification __TURBOC__ .
Version __TURBOC__ ?

Example

Turbo C __TURBOC__
2.0 397
3.0 661

Official site Wikipedia

Borland C++

Type Macro Format
Identification __BORLANDC__ .
Version __BORLANDC__ ?

Example

Borland C++ C++ Builder __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

Comeau C++

Type Macro Format Description
Identification __COMO__ . .
Version __COMO_VERSION__ VRR V = Version
RR = Revision

Example

Comeau C++ __COMO_VERSION__
2.3 230

Official site

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

Official site

Cray C

Type Macro Description
Identification _CRAYC .
Version _RELEASE Version
Version _RELEASE_MINOR Revision

Official site

Cygwin

Type Macro
Identification __CYGWIN__

Official site Wikipedia

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

Official site

Digital Mars

Type Macro Format Description
Identification __DMC__ . .
Identification __SC__ . Obsolete
Identification __ZTC__ . Obsolete
Version __DMC__ 0xVRP V = Version
R = Revision
PP = Patch

Example

Digital Mars __DMC__
7.0 0x700
7.2 0x720
8.0 0x800

Official site

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

Official site Google Directory Wikipedia

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

Official site

EDG C++ Front End

Type Macro Format Description
Identification __EDG__ . .
Version __EDG_VERSION__ VRR V = Version
RR = Revision

Example

EDG C++ __EDG_VERSION__
2.30 230

Official site

GNU C/C++

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

Example

GNU C/C++ __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__
2.7.x 2 7 .
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

Official site Google Directory Wikipedia

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

Official site Wikipedia

HP ANSI C

Type Macro
Identification __HP_cc

Official site

HP aCC

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)

HP aCC __HP_aCC
A.01.21 012100

Official site

IBM XL C/C++

Type Macro Format Description
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.

Example

IBM XL C/C++ __xlC__ __IBMC__
3.1 0x0301 .
4.5 0x0405 450
5.0 0x0500 500

Official site Wikipedia

IBM z/OS C/C++

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.

Type Macro Format Description
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

Example

IBM z/OS XL C/C++ __IBMC__ __COMPILER_VER__
1.7 41070 0x41070000

Official site Wikipedia

IAR C/C++

Type Macro Format Description
Identification __IAR_SYSTEMS_ICC__ . .
Version __VER__ VRR V = Version
RR = Revision

Example

IAR C/C++ __VER__
3.34 334

Official site

Intel C/C++

Type Macro Format Description
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

Example

Intel C/C++ __INTEL_COMPILER __INTEL_COMPILER_BUILD_DATE
5.0 500 .
6.0 600 .
8.0 800 .
9.0 900 20060222

Official site

KAI C++

Type Macro Format Description
Identification __KCC . .
Version __KCC_VERSION 0xVRPP V = Version
R = Revision
PP = Patch (a = 01, b = 02, ...)

Example

KAI C++ __KCC_VERSION
4.0d 4004

Official site

Keil CARM

Type Macro Format Description
Identification __CA__ . .
Identification __KEIL__ . .
Version __CA__ VRR V = Version
R = Revision

Example

Keil CARM __CA__
1.01 101

Official site

Keil C166

Type Macro Format Description
Identification __C166__ . .
Version __C166__ VRR V = Version
R = Revision

Example

Keil C166 __C166__
5.01 501

Official site

Keil C51

Type Macro Format Description
Identification __C51__ . .
Identification __CX51__ . .
Version __C51__ VRR V = Version
R = Revision

Example

Keil C51 __C51__
7.01 701

Official site

LCC

Type Macro
Identification __LCC__

Official site Wikipedia

LLVM

Type Macro
Identification __llvm__

Official site Wikipedia

MetaWare High C/C++

Type Macro
Identification __HIGHC__

Official site

Metrowerks CodeWarrior

Type Macro Format Description
Identification __MWERKS__ . .
Version __MWERKS__ 1 Until CodeWarrior 7
Version __MWERKS__ 0xVRPP V = Version
R = Revision
PP = Patch

From CodeWarrior 7

Example

Metrowerks C/C++ __MWERKS__
2.0 0x2000
2.2 0x2200

Official site Wikipedia

MinGW

Type Macro Description
Identification __MINGW32__ .
Version __MINGW32_MAJOR_VERSION Version
Version __MINGW32_MINOR_VERSION Revision

Example

MinGW __MINGW32_MAJOR_VERSION __MINGW32_MINOR_VERSION
2.4 2 4

Official site Wikipedia

MIPSpro

Type Macro Format Description
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 ?

Example

MIPSpro _COMPILER_VERSION _SGI_COMPILER_VERSION
6.0.2 602 .
7.2.1 721 .
7.4.4 . 744

Official site

MPW C++

Type Macro Format Description
Identification __MRC__ . .
Identification MPW_C . .
Identification MPW_CPLUS . .
Version __MRC__ 0xVVRR VV = Version
RR = Revision

Example

MPW C++ __MRC__
5.0 0x500

Official site

Microsoft Visual C++

Type Macro Format Description
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.

Example

Visual C++ _MSC_VER _MSC_FULL_VER
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

Microtec C/C++

Type Macro
Identification _MRI

Official site

Norcroft C

Type Macro Format Description
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.

Example

Norcroft C __ARMCC_VERSION
4.69 4.69
4.90 4.90

Pacific C

Type Macro
Identification __PACIFIC__

Official site

Palm C/C++

Type Macro Format Description
Identification _PACC_VER . .
Version _PACC_VER 0xVRRPPBBB V = Version
RR = Revision
PP = Patch
BBB = Build

Example

Palm C/C++ _PACC_VER
1.0.0.13 0x1000000D

Official site Google Directory

Pelles C

Type Macro Format Description
Identification __POCC__ . .
Version __POCC__ VRR V = Version
RR = Revision

Example

Pelles C __POCC__
3.00 300

Official site

Portland Group C/C++

Type Macro
Identification __PGI

Official site

RealView C

Type Macro Format Description
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.

Example

Realview C __ARMCC_VERSION
3.0 300503

Official site

SAS/C

Type Macro Format Description
Identification SASC . .
Identification __SASC . .
Identification __SASC__ . .
Version __VERSION__ . Until ?
Version __REVISION__ . Until ?
Version __SASC__ VRR V = Version
RR = Revision

From ?

Example

SAS/C __SASC__ __VERSION__ __REVISION__
5.10 . 5 10
6.50 650 . .

Official site

SCO OpenServer

Type Macro
Identification _SCO_DS

Official site

Small Device C Compiler

Type Macro Format Description
Identification SDCC . .
Version SDCC VRP V = Version
R = Revision
P = Patch

Example

SDCC Version SDCC Macro
2.5.6 256

Official site Google Directory Wikipedia

Sun Studio

Type Macro Format Description
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 .

Example

Sun Studio __SUNPRO_C
4.2 0x420
5.0 0x500

Official site

Systems/C and Systems/C++

Type Macro Format Description
Identification __SYSC__ . C compiler
Version __SYSC_VER__ VRRPP V = Version
RR = Revision
PP = Patch

Example

Systems/C __SYSC_VER__
1.80.32 18032

Official site

TenDRA C/C++

Type Macro
Identification __TenDRA__

Official site Wikipedia

Tiny C

Type Macro
Identification __TINYC__

Official site

Ultimate C/C++

Type Macro Description
Identification _UCC .
Version _MAJOR_REV = V
_MINOR_REV = R
V = Version
R = Revision

Example

Ultimate C/C++ _MAJOR_REV _MINOR_REV
2.1 2 1

USL C

Type Macro Format Description
Identification __USLC__ . .
Version __SCO_VERSION 0xVRRYYYYMM V = Version
RR = Revision
YYYY = Year
MM = Month

Example

USL C __SCO_VERSION
3.2 302199801

Official site

Watcom C++

Type Macro Format Description
Identification __WATCOMC__ . .
Version __WATCOMC__ VVRR VV = Version
RR = Revision

Example

Watcom C++ __WATCOMC__
10.5 1050
11.0 1100

Official site Wikipedia

分享到:
评论

相关推荐

    Microsoft Excel 2019 VBA and Macros

    Improve the reliability and resiliency of your macros Integrate data from the internet, Access databases, and other sources Automatically generate charts, visualizations, sparklines, and Word ...

    Mastering Clojure Macros(Pragmatic,2014)

    They can be tricky to use, and this book will help you deftly navigate the terrain. You'll discover how to write straightforward code that avoids duplication and clarifies your intentions. You'll ...

    acpi控制笔记本风扇转速

    condition is known to exist between AcpiWalkNamespace and the Load/Unload ASL operators and is still under investigation. Restructured the AML ParseLoop function, breaking it into several ...

    Universal-USB-Installer

    THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. By proceeding ...

    Microsoft.Excel.2019.VBA.and.Macros

    We can help you reduce the learning curve so that you can write your own VBA macros and put an end to the burden of generating reports manually. Reducing the learning curve This Introduction ...

    英文原版-Learning The Vi And Vim Editors 7th Edition

    such as multi-window editing, how to write both interactive macros and scripts to extend the editor, and power tools for programmers — all in the easy-to-follow style that has made this book a ...

    WizFlow网页编辑

    linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification ...

    hibernate-shards.jar

    linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification ...

    cpp-4.4.7-23.el6.x86-64.rpm

    and line control (if you use a program to combine or rearrange source files into an intermediate file which is then compiled, you can use line control to inform the compiler about where each source ...

    UE(官方下载)

    Use copied and selected text in macros to dramatically increase the power and flexibility of UltraEdit macros Run a macro or script from the command line We are often asked if it is possible to run an...

    (AIX 5L Version 5.2)Technical Reference: Base Operating System and Extensions, Volume 1

    This book is part of the six-volume technical reference set, AIX 5L Version 5.2 Technical Reference, that provides information on system calls, kernel extension calls, and subroutines in the following...

    cmake4eclipse-2.0.1.zip

    Its compiler-built-ins provider retrieves macros and include paths from the actual compiler, as far as the compiler supports that (including nvcc CUDA complier). For instructions inside the ...

    ARM® Compiler v5.06 for µVision® armasm User Guide

    1.1 About the ARM Compiler toolchain assemblers 1.2 Key features of the assembler 1.3 How the assembler works 1.4 Directives that can be omitted in pass 2 of the assembler 2 Overview of the ARM ...

    VBA and Macros: Microsoft Excel 2010 PDF

    I teach a course in India on Financial Modeling Using Excel to the MBA students in India and I use macros a lot in my models. I was looking for a good book on this subject which I can refer to for ...

    Excel 2016 VBA and Macros azw3

    Excel 2016 VBA and Macros 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书

    Clojure for the Brave and True

    Use Emacs for Clojure development, * Write macros to modify Clojure itself, * Use Clojure's tools to simplify concurrency and parallel programming, Clojure for the Brave and True assumes no prior ...

    Rust.Essentials.2nd.Edition.epub

    Throughout all this, we stress the unique ways of reasoning that the Rust compiler uses to produce safe code. Next we look at Rust's specific way of error handling, and the overall importance of ...

    NI Circuit Design Suite 12 注册鸡和授权鸡

    The upgrade to the PICC 9.82 (pro) compiler in Circuit Design Suite 12.0 may break existing code in MCU files since macros used by the compiler have changed. For example, WDTEN has been replaced with ...

Global site tag (gtag.js) - Google Analytics