This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC support for C++ noexcept


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
#endif

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]