转载自:http://www.cnblogs.com/zyl910/archive/2012/07/06/intel_predefined_macros.html
网上有很多介绍VC与GCC预定义宏的帖子,例如《C\C++宏大全》。
而对于Intel C++编译器的预定义宏,似乎没人介绍。
我Google了很久,发现Intel官网上有,但是很奇怪,很多链接都失效了,报告404错误。反复调整搜索关键字,一个一个的尝试链接,最后终于找到了有效的页面了。为了怕以后链接失效,赶紧记录下载。
该手册的名字是《Intel® C++ Compiler XE 12.1 User and Reference Guides》,分别有Windows版和Linux版——
Windows:http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/2011Update/cpp/win/index.htm
Linux:http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/2011Update/cpp/lin/index.htm
一、Windows版
1.1 ANSI Standard Predefined Macros(ANSI标准预定义宏)
The ANSI/ISO standard for the C language requires that certain predefined macros be supplied with conforming compilers. The following table lists the macros that the Intel® C++ Compiler supplies in accordance with this standard:
The compiler includes predefined macros in addition to those required by the standard. The default predefined macros differ among Windows*, Linux*, and Mac OS* X operating systems due to the default /Za compiler option on Windows. Differences also exist on Linux OS and Mac OS X as a result of the -std compiler option.
Macro |
Value |
---|---|
__DATE__ |
The date of compilation as a string literal in the formMmm dd yyyy. |
__FILE__ |
A string literal representing the name of the file being compiled. |
__LINE__ |
The current line number as a decimal constant. |
__STDC__ |
The name __STDC__ is defined when compiling a C translation unit. |
__STDC_HOSTED__ |
1 |
__TIME__ |
The time of compilation as a string literal in the formhh:mm:ss. |
1.2 Additional Predefined Macros(额外的预定义宏)
The Intel® C++ Compiler supports the predefined macros listed in the table below. The compiler also includes predefined macros specified by the ISO/ANSI standard.
The following table lists the predefined macros on systems based on either the IA-32 or Intel® 64 architecture.
These labels apply:
-
i32 means that the macro is included on systems based on IA-32 architecture.
-
i64em means that the macro is included on systems based on Intel® 64 architecture.
Macro Name |
Value |
i32 |
i64em |
---|---|---|---|
__cilk |
200; however, if /Qcilk-serialize or /Qintel-extensions- is specified, the value is undefined |
X |
X |
__COUNTER__ |
0 |
X |
X |
__ECL |
Intel compiler version |
||
__EDG__ |
1 |
X |
X |
__EDG_VERSION__ |
EDG version |
X |
X |
_export |
no value |
X |
X |
__ICL |
Intel compiler version |
X |
X |
_INC_STDIO |
no value |
X |
X |
_INTEGRAL_MAX_BITS |
64 |
X |
X |
__INTEL_COMPILER |
Intel compiler version |
X |
X |
__INTEL_COMPILER_BUILD_DATE |
YYYYMMDD |
X |
X |
__INTEL_MS_COMPAT_LEVEL |
1 |
X |
X |
__LONG_DOUBLE_SIZE__ |
64 |
X |
X |
_M_AMD64 |
1 |
X |
|
_M_IX86 |
700 |
X |
X |
_M_IA64 |
64200 |
X |
|
_M_X64 |
1 |
X |
|
_MSC_EXTENSIONS |
1 |
X |
X |
_MSC_FULL_VER |
IA-32 architecture only: |
X |
X |
_MSC_VER |
1400, 1500, or 1600, depending on the Microsoft Visual Studio* environment (Visual Studio 2005, 2008, or 2010, respectively). |
X |
X |
_MT |
1 |
X |
X |
_OPENMP |
200805 |
X |
X |
_PGO_INSTRUMENT |
1 |
X |
X |
__QMSPP_ |
1 |
X |
|
__SIGNED_CHARS__ |
1 |
X |
X |
_SIZE_T_DEFINED |
no value |
X |
X |
__STDC_VERSION__ |
199409L |
X |
X |
__w64 |
no value |
X |
X |
_WCHAR_T_DEFINED |
no value |
X |
X |
_WCTYPE_T_DEFINED |
no value |
X |
X |
_WIN32 |
1 |
X |
X |
_WIN64 |
1 |
X |
|
_VA_LIST_DEFINED |
no value |
X |
X |
二、Linux版
2.1 ANSI Standard Predefined Macros(ANSI标准预定义宏)
The ANSI/ISO standard for the C language requires that certain predefined macros be supplied with conforming compilers. The following table lists the macros that the Intel® C++ Compiler supplies in accordance with this standard:
The compiler includes predefined macros in addition to those required by the standard. The default predefined macros differ among Windows*, Linux*, and Mac OS* X operating systems due to the default /Za compiler option on Windows. Differences also exist on Linux OS and Mac OS X as a result of the -std compiler option.
Macro |
Value |
---|---|
__DATE__ |
The date of compilation as a string literal in the formMmm dd yyyy. |
__FILE__ |
A string literal representing the name of the file being compiled. |
__LINE__ |
The current line number as a decimal constant. |
__STDC__ |
The name __STDC__ is defined when compiling a C translation unit. |
__STDC_HOSTED__ |
1 |
__TIME__ |
The time of compilation as a string literal in the formhh:mm:ss. |
2.2 Additional Predefined Macros(额外的预定义宏)
The Intel® C++ Compiler includes a number of predefined macros. The compiler also includes predefined macros specified by the ISO/ANSI standard.
Predefined Macros on Systems based on IA-32 or Intel® 64 Architectures
The following table lists the predefined macros on systems based on either the IA-32 or Intel® 64 architecture.
Unless otherwise stated, the macros are supported on systems based on IA-32 architecture and also on systems based on Intel® 64 architecture.
Macro (IA-32 and Intel® 64 architecture) |
Value |
---|---|
__ARRAY_OPERATORS |
1 |
__BASE_FILE__ |
Name of source file |
_BOOL |
1 |
__cilk |
200; however, if -cilk-serialize or -no-intel-extensions is specified, the value is undefined. |
__cplusplus |
1 (with C++ compiler) |
__DEPRECATED |
1 |
__EDG__ |
1 |
__EDG_VERSION__ |
EDG version |
__ELF__ |
1 |
__extension__ |
|
__EXCEPTIONS |
Defined as 1 when -fno-exceptions is not used. |
__GNUC__ |
The major version number of gcc installed on the system. |
__GNUG__ |
The major version number of g++ installed on the system. |
__gnu_linux__ |
1 |
__GNUC_MINOR__ |
The minor version number of gcc or g++ installed on the system. |
__GNUC_PATCHLEVEL__ |
The patch level version number of gcc or g++ installed on the system. |
__GXX_ABI_VERSION |
102 |
__HONOR_STD |
1 |
__i386 Available only on systems based on IA-32 architecture. |
1 |
__i386__ Available only on systems based on IA-32 architecture. |
1 |
i386 Available only on systems based on IA-32 architecture. |
1 |
__ICC |
Intel compiler version |
__INTEL_COMPILER |
Intel compiler version |
__INTEL_COMPILER_BUILD_DATE |
YYYYMMDD |
__INTEL_RTTI__ |
Defined as 1 when -fno-rtti is not specified. |
__INTEL_STRICT_ANSI__ |
Defined as 1 when -strict-ansi is specified. |
__linux |
1 |
__linux__ |
1 |
linux |
1 |
__LONG_DOUBLE_SIZE__ |
80 |
__LONG_MAX__ Available only on systems based on Intel® 64 architecture. |
9223372036854775807L |
__LP64__ Available only on systems based on Intel® 64 architecture. |
1 |
_LP64 Available only on systems based on Intel® 64 architecture. |
1 |
_MT Available only on systems based on Intel® 64 architecture. |
1 |
__MMX__ Available only on systems based on Intel® 64 architecture. |
1 |
__NO_INLINE__ |
1 |
__NO_MATH_INLINES |
1 |
__NO_STRING_INLINES |
1 |
_OPENMP |
Defined as 200805 when -openmp is specified. |
__OPTIMIZE__ |
1 |
__pentium4 |
1 |
__pentium4__ |
1 |
__PIC__ |
Defined as 1 when -fPIC is specified. |
__pic__ |
Defined as 1 when -fPIC is specified. |
_PGO_INSTRUMENT |
Defined as 1 when -prof-gen[x] is specified. |
_PLACEMENT_DELETE |
1 |
__PTRDIFF_TYPE__ |
int on IA-32 architecture; |
__REGISTER_PREFIX__ |
|
__SIGNED_CHARS__ |
1 |
__SIZE_TYPE__ |
unsigned on IA-32 architecture |
__SSE__ |
Defined as 1 for processors that support SSE instructions. |
__SSE2__ |
Defined as 1 for processors that support SSE2 instructions. |
__SSE3__ |
Defined as 1 for processors that support SSE3 instructions. |
__SSSE3__ |
Defined as 1 for processors that support SSSE3 instructions. |
__unix |
1 |
__unix__ |
1 |
unix |
1 |
__USER_LABEL_PREFIX__ |
|
__VERSION__ |
Intel version string |
__WCHAR_T |
1 |
__WCHAR_TYPE__ |
long int on IA-32 architecture |
__WINT_TYPE__ |
unsigned int |
__x86_64 Available only on systems based on Intel® 64 architecture. |
1 |
__x86_64__ Available only on systems based on Intel® 64 architecture. |
1 |