Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 12/16/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Additional Predefined Macros

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

Unless otherwise stated, the macros are supported on systems based on IA-32 and Intel® 64 architectures. IA-32 is not available on macOS*.

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 whether this is 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 Description

__APPLE__

(macOS)

Defined as '1'.

__APPLE_CC__

(macOS)

The gcc* build number

__ARRAY_OPERATORS

(Linux*)

Defined as '1'.

__AVX__

(Windows*, Linux, macOS)

On Windows*, defined as '1' when option /arch:AVX, /QxAVX, or higher processor targeting options are specified.

On Linux*, defined as '1' when option -march=corei7-avx, -mavx, -xAVX, or higher processor targeting options are specified.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

__AVX2__

(Windows, Linux, macOS)

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

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

NOTE:

Available only for compilations targeting Intel® 64 architecture.

__AVX512BW__

(Windows*, Linux, macOS)

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

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

__AVX512CD__

(Windows*, Linux, macOS)

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

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

__AVX512DQ__

(Windows*, Linux, macOS)

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

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

__AVX512ER__

(Windows*, Linux, macOS)

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

__AVX512F__

(Windows*, Linux, macOS)

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

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

__AVX512PF__

(Windows*, Linux, macOS)

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

__AVX512VL__

(Windows*, Linux, macOS)

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

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

__BASE_FILE__

(Linux)

Name of source file

_BOOL

(Linux)

Defined as '1'.

__COUNTER__

(Windows)

Defined as '0'.

__cplusplus

(Linux)

Defined as '1' (for the Intel® C++ Compiler).

__DEPRECATED

(Linux)

Defined as '1'.

__DYNAMIC__

(macOS)

Defined as '1'.

__EDG__

(Windows, Linux, macOS)

Defined as '1'.

__EDG_VERSION__

(Windows, Linux, macOS)

EDG version

__ELF__

(Linux)

Defined as '1' at the start of compilation.

__EXCEPTIONS

(Linux)

Defined as '1' when option fno-exceptions is not used.

__gnu_linux__

(Linux)

Defined as '1' at the start of compilation.

__GNUC__

(Linux)

The major version number of gcc* installed on the system or explicitly specified via –gcc-name/ –gxx-name.

__GNUC_MINOR__

(Linux)

The minor version number of gcc* or g++* installed on the system or explicitly specified via –gcc-name/ –gxx-name.

__GNUC_PATCHLEVEL__

(Linux)

The patch level version number of gcc* or g++* installed on the system or explicitly specified via –gcc-name/ –gxx-name.

__GNUG__

(Linux)

The major version number of g++* installed on the system or explicitly specified via –gcc-name/ –gxx-name.

__GXX_ABI_VERSION

(Linux)

The value of this 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, macOS)

Defined as '1' for compilations targeting IA-32 architecture. IA-32 is not available on macOS*.

__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)

64

__INTEL_COMPILER

(Windows*, Linux, macOS)

The version of the compiler.

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

__INTEL_COMPILER_BUILD_DATE

(Windows*, Linux, macOS)

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

(Windows, Linux, macOS)

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

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 preprocess to "2".

__INTEL_CXX11_MODE__

(Windows, Linux)

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

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

__INTEL_MS_COMPAT_LEVEL

(Windows)

Defined as '1'.

Equal to the same value n as specified by option [Q]msn.

__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__

(Windows*, Linux, macOS)

On Linux and macOS, defined as 80.

On Windows, defined as 64; defined as 80 when option /Qlong-double is specified.

__LONG_DOUBLE_64__

(Linux)

When this macro is defined, the long double type is 64-bits.

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

__LONG_MAX__

(Linux)

9223372036854775807L

NOTE:

Available only for compilations targeting Intel® 64 architecture.

__LP64__ (Linux)

__LP64 (Linux)

Defined as '1'.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

_M_AMD64

(Windows)

Defined as '1' while building code targeting Intel® 64 architecture.

_M_IX86

(Windows)

700

_M_X64

(Windows)

Defined as '1' while building code targeting Intel® 64 architecture.

__MACH__

(macOS)

Defined as '1'.

__MMX__

(Linux, macOS)

Defined as '1'.

On Linux, it is available only on systems based on Intel® 64 architecture.

_MSC_EXTENSIONS

(Windows)

Defined as '1'.

This macro is 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)

On Windows, defined as '1' when a multithreaded DLL or library is used (when option /MD[d] or /MT[d] is specified).

__NO_INLINE__

__NO_MATH_INLINES

__NO_STRING_INLINES

(Linux, macOS)

Defined as '1'.

_OPENMP

(Windows, Linux, macOS)

201611 when you specify option [Q]openmp.

__OPTIMIZE__

(Linux, macOS)

Defined as '1'.

__pentium4

__pentium4__

(Linux, macOS)

Defined as '1'.

_PGO_INSTRUMENT

(Windows, Linux)

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

__PIC__

__pic__

(Linux, macOS)

On Linux, defined as '1' when option fPIC is specified.

On macOS, defined as '1'. Only __PIC__ is allowed on macOS.

_PLACEMENT_DELETE

(Linux)

Defined as '1'.

__PTRDIFF_TYPE__

(Linux, macOS)

On Linux, defined as int on IA-32 architecture; defined as long on Intel® 64 architecture.

On macOS, defined as int/long.

__QMSPP_

(Windows, macOS)

Defined as '1'.

__REGISTER_PREFIX__

(Linux, macOS)

 

__SIGNED_CHARS__

(Windows, Linux, macOS)

Defined as '1'.

_SIZE_T_DEFINED

(Windows)

Defined, no value.

__SIZE_TYPE__

(Linux, macOS)

On Linux, defined as unsigned on IA-32 architecture; defined as unsigned long on Intel® 64 architecture.

On macOS, defined as unsigned long.

__SSE__

(Windows, Linux, macOS)

On Linux and macOS, defined as '1' for processors that support SSE instructions.

On Windows, defined as '1'. It is undefined when option /arch:IA32 is specified.

__SSE2__

(Windows, Linux, macOS)

On Linux and macOS, defined as '1' for processors that support Intel® SSE2 instructions.

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

__SSE3__

(Windows, Linux, macOS)

On Linux and macOS, defined as '1' for processors that support Intel® SSE3 instructions.

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

__SSE4_1__

(Windows, Linux)

On Linux, defined as '1' for processors that support Intel® SSE4 instructions.

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

__SSE4_2__

(Windows, Linux)

On Linux, defined as '1' for processors that support SSSE4 instructions.

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

__SSSE3__

(Windows, Linux, macOS)

On Linux and macOS, defined as '1' for processors that support SSSE3 instructions.

On 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)

 

_VA_LIST_DEFINED

(Windows)

Defined, no value.

__VERSION__

(Linux, macOS)

The compiler version string

__w64

(Windows)

Defined, no value.

__WCHAR_MAX__

(macOS)

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)

On Linux, defined as long int on IA-32 architecture; defined as int on Intel® 64 architecture.

On macOS, defined as long int.

_WCTYPE_T_DEFINED

(Windows)

Defined when "wctype_t" is defined in the header file.

_WIN32

(Windows)

Defined as '1' while building code targeting IA-32 or Intel® 64 architecture.

IA-32 is not available on macOS*.

_WIN64

(Windows)

Defined as '1' while building code targeting Intel® 64 architecture.

__WINT_TYPE__

(Linux, macOS)

Defined as unsigned int.

__x86_64

__x86_64__

(Linux, macOS)

Defined as '1' while building code targeting Intel® 64 architecture.

See Also