On 05/03/2013 06:40 AM, Rene Rivera wrote:
It also incorrectly says that it is GCC compiler. This is because Intel likes to do that for compatibility with GCC (I believe clang also defines __GNUC_).
This is actually intentional, even if a bit confusing. If a compiler decides that it wants to emulate another compiler it's OK for me to detect both compilers at once. It's then up to users to decide if the compiler does actually emulate the compiler correctly. Basically I err on the side of more information.
The following is a quote from the predef.sourceforge.net pages: "Notice that the meaning of the __GNUC__ macro has changed subtly over the years, from identifying the GNU C/C++ compiler to identifying any compiler that implements the GNU compiler extensions (see the "Feature request - a macro defined for GCC" [1] discussion for further information). For example, the Intel C++ on Linux also defines these macros from version 8.1 (see the "Intel C++ Compiler 8.1 for Linux Release Notes" [2] and "Intel Compilers for Linux: Compatibility with GNU Compilers" [3].)" [1] http://gcc.gnu.org/ml/gcc/2008-07/threads.html#00025 [2] ftp://download.intel.com/support/performancetools/c/linux/sb/clin81_relnotes.pdf) [3] http://software.intel.com/en-us/articles/intel-compilers-for-linux-compatibi... The way to avoid false positives, is to know which other compilers define the GCC macros, and test for these first. For instance: #if defined(__INTEL_COMPILER) // Do Intel stuff #else # if defined(__GNUC__) // Do GCC stuff # endif #endif