Boost logo

Boost :

Subject: Re: [boost] [predef] Status and review results?
From: Bjorn Reese (breese_at_[hidden])
Date: 2013-05-03 07:10:27

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 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].)"


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
# if defined(__GNUC__)
// Do GCC stuff
# endif

Boost list run by bdawes at, gregod at, cpdaniel at, john at