tags:

views:

260

answers:

2

Is there any official, or inofficial, #defines for when a compiler is Cpp0x compliant? Even better, for specific Cpp0x functionality (~#cpp0xlambda, #cpp0xrvalue etc)?

(Haven't found anything about this on the net)

+13  A: 

For C++03 according to 16.8/1 (Predefined macro names):

The name __cplusplus is defined to the value 199711L when compiling a C++ translation unit.

For C++0x draft n2857 according to 16.8/1 (Predefined macro names):

The name __cplusplus is defined to the value [tbd] when compiling a C++ translation unit.

Kirill V. Lyadvinsky
It is reaonable to expect this to be a number > `200911L` but < `201012L`
MSalters
No #defines for specific functionality?
Viktor Sehr
Defines for specific functionality could be defined by implementation. Standard doesn't have such defines.
Kirill V. Lyadvinsky
@Viktor Sehr: Either a compiler implement the standard or not, there is nothing in-between. __cplusplus may not be set to the predefined value if the full standard isn't implemented.
dalle
`201012L`? You're optimistic. :)
Roger Pate
+6  A: 

Bjarne's C++0x FAQ says:

__cplusplus

In C++0x the macro __cplusplus will be set to a value that differs from (is greater than) the current 199711L.

Mark Rushakoff
But the macro `__cplusplus` should not be set to `199711L` for any compiler that does not implement the *full* C++98 standard.
dalle