GCC support for C++ noexcept

Edward Diener eldlistmailingz@tropicsoft.com
Tue Aug 4 14:34:00 GMT 2015

On 7/28/2015 5:41 AM, Jonathan Wakely wrote:
> On 28 July 2015 at 00:17, Edward Diener wrote:
>> I see your point. The code I mentioned should really be:
>> #if defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__cplusplus) &&
>> __cplusplus >= 201103L
> The defined(__cplusplus) check is redundant, an undefined token in a
> preprocessor conditional is treated as 0.

You are right. Therefore, as I originally stated:

#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
// C++11 is in effect

is correct to determine whether C++11 is in effect for any given version 
of gcc. If you are compiling in C mode C++11 can never be in effect and 
the check above reflects that. If you are compiling in C++ mode one or 
the other being true will tell you that C++11 mode is being used.

I think what Boost config uses is correct for determining C++11 mode for 
its own use. Of course what C++11 mode means for Boost config may be 
different than what the OP means.

More information about the Gcc-help mailing list