[v3] c++0x includes

Peter Dimov pdimov@mmltd.net
Sun Mar 11 15:43:00 GMT 2007


Doug Gregor wrote:
> On 3/11/07, Peter Dimov <pdimov@mmltd.net> wrote:
>> I guess it could be, depending on the compiler... my copy of C++03
>> still says 199711L in [cpp.predefined], though. One can always play
>> safe and check against 200703L.
>
> Gaa! That sets a very scary precedent, I think. It at least invites us
> to be clever:
>
> #if __cplusplus > 200703L
> // add rvalue reference support
>  #if __cplusplus > 200708L
>  // add decltype support
>    #if __cplusplus > 200711L
>    // add concepts support
>    #endif
>  #endif
> #endif

No, no. My point is that __cplusplus can be one of:

unspecified five-digit number // pre-standard C++
199711L // C++98, conforming C++03
unspecified value between 199712L and 200312L // 'detectable' C++03
unspecified value >= 200703L (now) // C++09

(ignoring subsequent standards)

so in theory a single test is enough to detect C++09 even without knowing 
the exact value. 



More information about the Libstdc++ mailing list