Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 7/13/2023
Public
Document Table of Contents

Additional Predefined Macros

The compiler includes predefined macros specified by the ISO/ANSI standard and it also supports the predefined macros listed in the table below.

Unless otherwise stated, the macros are supported on systems based on IA-32 (C/C++ only) and Intel® 64 architectures.

NOTE:

The Intel® C++ Compiler defines the same target-architecture macros that GCC does. For -m feature, GCC defines __FEATURE__.

You can target specific processor architectures by using the -x, -m, and -march compiler options. Each of these options enables feature-specific macros in the compiler. These macros are used to guard a section of application code that uses target-specific feature. The following command emits the list of predefined macros enabled by targeting a specific processor architecture:

icpc -dM -E helloworld.cc -xarch

For example, you could do the following to determine which feature macros would help identify an ICELAKE-SERVER:

icpc -dM -E helloworld.cc -xSKYLAKE-AVX512 > avx512.txt 2>&1
icpc -dM -E helloworld.cc -xICELAKE-SERVER > icelake.txt 2>&1
diff avx512.txt icelake.txt
 317a318
 > #define AVX512IFMA 1
 320a322,329
 > #define AVX512VBMI 1
 > #define AVX512VPOPCNTDQ 1
 > #define AVX512BITALG 1
 > #define AVX512VBMI2 1
 > #define GFNI 1
 > #define VAES 1
 > #define VPCLMUL 1
 > #define AVX512VNNI 1
 321a331,334
 > #define RDPID 1
 > #define SGX 1
 > #define WBNOINVD 1
 > #define PCONFIG 1

The result of the diff command is the list of feature macros that can be used to differentiate icelake-server from skylake-avx512.

Macro OS Support Description

__APPLE__

macOS

Defined as 1.

__APPLE_CC__

macOS

The GCC build number.

__ARRAY_OPERATORS

Linux

Defined as 1.

__AVX__

Linux

macOS

Windows

Linux: Defined as 1 when option -march=corei7-avx, -mavx, -xAVX, or higher processor targeting options are specified.

Windows: Defined as 1 when option /arch:AVX, /QxAVX, or higher processor targeting options are specified.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

__AVX2__

Linux

macOS

Windows

Linux: Defined as 1 when option -march=core-avx2,-xCORE-AVX2, or higher processor targeting options are specified.

Windows: Defined as 1 when option /arch:CORE-AVX2, /QxCORE-AVX2, or higher processor targeting options are specified.

NOTE:

When any of the above options are specified, they also define macro AVX.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

__AVX512BW__

Linux

macOS

Windows

Defined as 1 for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Byte and Word Instructions (BWI).

__AVX512BW__ is also defined as 1 when option [Q]xCORE-AVX512 or higher processor-targeting options are specified.

__AVX512CD__

Linux

macOS

Windows

Defined as 1 for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Conflict Detection Instructions (CDI).

__AVX512CD__ is also defined as 1 when option [Q]xCORE-AVX512, [Q]xCOMMON-AVX512, or higher processor-targeting options are specified.

__AVX512DQ__

Linux

macOS

Windows

Defined as 1 for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Doubleword and Quadword Instructions (DQI).

__AVX512DQ__ is also defined as 1 when option [Q]xCORE-AVX512 or higher processor-targeting options are specified.

__AVX512ER__

Linux

macOS

Windows

Defined as 1 for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Exponential and Reciprocal Instructions.

__AVX512F__

Linux

macOS

Windows

Defined as 1 for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Foundation instructions.

__AVX512ER__ is also defined as 1 when option [Q]xCORE-AVX512, [Q]xCOMMON-AVX512, or higher processor-targeting options are specified.

__AVX512PF__

Linux

macOS

Windows

Defined as 1 for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) PreFetch Instructions (PFI).

__AVX512VL__

Linux

macOS

Windows

Defined as 1 for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Vector Length Extensions (VLE).

It is also defined as 1 when option [Q]xCORE-AVX512 or higher processor-targeting options are specified.

__BASE_FILE__

Linux

Windows

Name of source file.

_BOOL

Linux

Defined as 1.

__COUNTER__

Linux

Windows

Defined as zero.

__cplusplus

Linux

Defined when compiling C++. The setting depends on which -std=c++nn option is in effect. The default is 201703L.

__DEPRECATED

Linux

Defined as 1.

__DYNAMIC__

macOS

Defined as 1.

__EDG__

Linux

macOS

Windows

Defined as 1.

__EDG_VERSION__

Linux

macOS

Windows

EDG version

__ELF__

Linux

Defined as 1 at the start of compilation.

__EXCEPTIONS

Linux

Defined as 1 when C++ exceptions are enabled (default for C++). Not defined in C or when option -fno-exceptions is specified.

__gnu_linux__

Linux

Defined as 1 at the start of compilation.

__GNUC__

Linux

Defined as 4.

__GNUC_MINOR__

Linux

Defined as 2.

__GNUC_PATCHLEVEL__

Linux

Defined as 1.

__GNUG__

Linux

Defined as 4 when compiling C++.

__GXX_ABI_VERSION

Linux

The value of this macro is dependent on the fabi-version option in effect.

102: fabi-version=1 || gcc version < 3.4

1008: gcc version >= 5.0

999999: -fabi-version=0

100? Where ? matches the -fabi-version passed: -fabi-version=2,3,4,5,6,7,8,9

1002: Gcc version > 3.5 and < 5.0

__HONOR_STD

Linux

macOS

Defined as 1.

__i386__

__i386

i386

Linux

Defined as 1 for compilations targeting IA-32 architecture (C++ only).

__ICC

Linux

macOS

The version of the compiler.

NOTE:
This macro may be affected by compiler options, such as -no-icc.

__ICL

Windows

The version of the compiler.

NOTE:
This macro may be affected by compiler options such as /Qicl-.

_INC_STDIO

Windows

Defined, no value.

_INTEGRAL_MAX_BITS

Windows

Defined as 64.

__INTEL_COMPILER

Linux

macOS

Windows

The version of the compiler.

NOTE:
This macro may be affected by compiler options such as -no-icc.

__INTEL_COMPILER_BUILD_DATE

Linux

macOS

Windows

The compiler build date. It takes the form YYYYMMDD, where YYYY is the year, MM is the month, and DD is the day.

__INTEL_COMPILER_UPDATE

Linux

macOS

Windows

Returns the current minor update number of the compiler, starting at zero.

You can use this macro to differentiate between compiler updates when you have multiple updates of the Intel® C++ Compiler installed concurrently.

Example: For Intel® C++ Compiler version XX.0.2, the macro would return 2.

__INTEL_CXX11_MODE__

Linux

Windows

Enables C++11 experimental support for C++ programs.

Defined as 1 when option [Q]std=c++11 is specified.

__INTEL_RTTI__

Linux

macOS

Defined as 1 when option fno-rtti is not specified.

__INTEL_STRICT_ANSI__

Linux

macOS

Defined as 1 when option strict-ansi is specified.

__linux__

__linux

linux

Linux

Defined as 1 at the start of compilation.

__LITTLE_ENDIAN__

macOS

Defined as 1.

__LONG_DOUBLE_SIZE__

Linux

macOS

Windows

Linux and macOS: Defined as 80.

Windows: Defined as 64. However, if option Qlong-double is specified, it is defined as 80.

__LONG_DOUBLE_64__

Linux

Defines long double type as 64-bits.

It is also defined when you specify option -mlong-double-64.

__LONG_MAX__

Linux

Windows

Linux:

  • Intel® 64 architecture: Defined as 9223372036854775807L.

  • IA-32 architecture: Defined as 2147483647L.

Windows: Defined as 2147483647L.

__LP64__

Linux

Defined as 1.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

_M_AMD64

Windows

Defined as 1.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

_M_IX86

Windows

Defined as 600.

NOTE:

Available only for compilations targeting IA-32 architecture.

_M_X64

Windows

Defined as 100.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

__MACH__

macOS

Defined as 1.

__MMX__

Linux

macOS

Defined as 1.

NOTE:

Linux: Available only for compilations targeting Intel® 64 architecture.

_MSC_EXTENSIONS

Windows

Defined as 1.

Defined when Microsoft extensions are enabled.

_MSC_FULL_VER

Windows

The Visual C++ version being used.

190022609 for Visual C++ 2015

1800210051 for Visual C++ 2013

_MSC_VER

Windows

The Visual C++ version being used.

1900 for Visual C++ 2015

1800 for Visual C++ 2013

_MT

Windows

Defined as 1 when a multithreaded dynamic-link library (DLL) is used (that is, when option /MD[d] or /MT[d] is specified).

__NO_INLINE__

__NO_MATH_INLINES

__NO_STRING_INLINES

Linux

macOS

Defined as 1.

_OPENMP

Linux

macOS

Windows

The default is 201811 when you specify option [q or Q]openmp.

__OPTIMIZE__

Linux

macOS

Defined as 1 when optimization is used.

Not defined if option -O0 is specified or in effect.

__pentium4

__pentium4__

Linux

macOS

Defined as 1.

_PGO_INSTRUMENT

Linux

Windows

Defined as 1 when option [Q]cov-gen or [Q]prof-gen is specified.

__PIC__

__pic__

Linux

macOS

Linux: Defined as 1 when option -fpic is specified.

macOS: Defined as 1. Only __PIC__ is allowed on macOS.

_PLACEMENT_DELETE

Linux

Defined as 1.

__PTRDIFF_TYPE__

Linux

macOS

Windows

Linux: Defined as int on IA-32 architecture (C++ only); defined as long int on Intel® 64 architecture.

macOS: Defined as long int.

Windows: Defined as int on IA-32 architecture (C++ only); defined as long long int on Intel® 64 architecture.

__REGISTER_PREFIX__

Linux

macOS

Sets the prefix applied to CPU register names in assembly language. 

__SIZE_TYPE__

Linux

macOS

Windows

Linux: Defined as unsigned int on IA-32 architecture (C++ only); defined as unsigned long int on Intel® 64 architecture.

macOS: Defined as unsigned long int.

Windows: Defined as unsigned int on IA-32 architecture (C++ only); defined as unsigned long long int on Intel® 64 architecture.

__SSE__

Linux

macOS

Windows

Linux and macOS: Defined as 1 for processors that support SSE instructions.

Windows: Defined as 1. It is undefined when option /arch:IA32 is specified.

__SSE2__

Linux

macOS

Windows

Linux and macOS: Defined as 1 for processors that support Intel® SSE2 instructions.

Windows: Defined as 1 by default or when option /arch:SSE2, /QxSSE2, /QaxSSE2, or higher processor targeting options are specified.

__SSE3__

Linux

macOS

Windows

Linux and macOS: Defined as 1 for processors that support Intel® SSE3 instructions.

Windows: Defined as 1 when option /arch:SSE3, /QxSSE3, or higher processor targeting options are specified.

__SSE4_1__

Linux

Windows

Linux: Defined as 1 for processors that support Intel® SSE4 instructions.

Windows: Defined as 1 when option /arch:SSE4.1, /QxSSE4.1, or higher processor targeting options are specified.

__SSE4_2__

Linux

Windows

Linux: Defined as 1 for processors that support SSSE4 instructions.

Windows: Defined as 1 when option /arch:SSE4.2, /QxSSE4.2, or higher processor targeting options are specified.

__SSSE3__

Linux

macOS

Windows

Linux and macOS: Defined as 1 for processors that support SSSE3 instructions.

Windows: Defined as 1 when option /arch:SSSE3, /QxSSSE3, or higher processor targeting options are specified.

__STDC__

macOS

Defined as 1.

__STDC_HOSTED__

macOS

Defined as 1.

unix

__unix

__unix__

Linux

Defined as 1.

__USER_LABEL_PREFIX__

Linux

macOS

The prefix applied to user labels in assembly language. 

__VERSION__

Linux

macOS

The compiler version string.

__WCHAR_MAX__

macOS

Defined as 2147483647.

__WCHAR_T

Linux

Defined as 1.

_WCHAR_T_DEFINED

Windows

Defined when option /Zc:wchar_t is specified or wctype_t is defined in the header file.

__WCHAR_TYPE__

Linux

macOS

Windows

Linux: Defined as int.

macOS: Defined as unsigned int.

Windows: Defined as unsigned short int.

_WCTYPE_T_DEFINED

Windows

Defined when wctype_t is defined in the header file.

_WIN32

Windows

Defined as 1.

_WIN64

Windows

Defined as 1 when building code targeting Intel® 64 architecture.

__WINT_TYPE__

Linux

macOS

Windows

Linux: Defined as unsigned int.

Windows: Defined as unsigned short int.

__x86_64

__x86_64__

Linux

macOS

Defined as 1 when building code targeting Intel® 64 architecture.

See Also