[cfe-dev] Libc++ Windows Semi-analyzed test results

Marc Glisse marc.glisse at inria.fr
Wed Sep 28 13:00:08 PDT 2011


On Wed, 28 Sep 2011, Howard Hinnant wrote:

> #include <iostream>
>
> int main()
> {
>    std::cout << __cplusplus << '\n';
> }
>
> Without -std=c++0x:
>
> 1
>
> With -std=c++0x:
>
> 201103

NOOOOOOOO!!!
:-(

What is the rational for defining it before the C++11 support is (almost) 
complete? The main point of the value of this macro is imho to be able to 
detect whether we can use C++11 features. If you want to indicate 
experimental partial support, a compiler specific macro is fine. But 
defining __cplusplus to 201103 when the new standard isn't implemented yet 
makes the macro useless. The only rational I could think of is that the 
C++11 mode of clang is considered experimental and unsupported and thus it 
doesn't matter that it doesn't work...

As a (header) library writer who wants to use C++11 features if possible, 
my choices are __cplusplus or version tests on all the compilers I can get 
my hands on. You can guess which one I prefer.

I'm sure there was a good reason for setting the new value and I'd like to 
hear it... (this discussion probably should have taken place on the 
reflectors to get the vendors to agree on a strategy)

-- 
Marc Glisse



More information about the cfe-dev mailing list