I recently conducted a quick-and-dirty survey of C++11 (formerly known as C++0x) features available on various platforms and compilers that I had lying around. My testing was not authoritative nor rigorous. (For example, g++ without -std=c++0x actually compiles lambdas without throwing an error, so I marked it as supported even though it does give a stern warning.) I'm posting the results here, mostly for my own future reference.
| Mac OS 10.6 / Xcode 4.2 gcc version 4.2.1 Apple clang version 3.0 |
Ubuntu 12.04 gcc version 4.6.3 Ubuntu clang version 3.0-6ubuntu3 |
Windows 7 MSVC++ 2010 |
||||||
| g++ | clang++ | clang++ -std=c++0x | g++ | g++ -std=c++0x | clang++ | clang++ -std=c++0x | cl.exe /clr | |
| __cplusplus | 1L | 1L | 201103L | 1L | 1L | 1L | 201103L | 199711L |
| __GXX_EXPERIMENTAL_CXX0X__ | undef | undef | 1 | undef | 1 | undef | 1 | undef |
| omit space in nested template ">>" | X | X | X | X | ||||
| std::tr1::shared_ptr | X | X | X | X | X | X | X | |
| std::shared_ptr | X | X | X | |||||
| nullptr | X | X | X | X | ||||
| auto | X | X | X | X | X | |||
| uniform initialization | X | |||||||
| for range (foreach) | X | X | X | X | X | |||
| move semantics (std::move) | X | X | ||||||
| raw string literals | X | X | ||||||
| encoded string literals | X | X | ||||||
| noexcept | X | X | X | |||||
| constexpr | X | X | X | |||||
| variadic templates | X | X | X | X | X | X | ||
| lambdas | X | X | X | |||||
| decltype | X | X | X | X | ||||
| new function declaration style | X | X | X | X | ||||
| scoped enums | X | X | X | X | ||||
| std::function | X | X | X | |||||
| std::tr1::function | X | X | X | X | X | X | X | |
| can autodetect need for std::tr1 | X | X | X | X | X | X | X | X |
Other, probably more thorough information about C++11 feature support:
- C++0xCompilerSupport (Apache's C++ Standard Library Wiki)
- Summary of C++11 Feature Availability in gcc and MSVC (Scott Meyers)
- C++0x Core Language Features In VC10: The Table (Microsoft)
My quick-and-dirty test suite is available for download.
UPDATE 2013-05-27: More recent platforms and compilers, below...
| Mac OS 10.8 / Xcode 4.6.2 gcc version 4.2.1 Apple clang version 3.3 |
Ubuntu 13.04 gcc version 4.7.3 Ubuntu clang version 3.2-1~exp9ubuntu1 |
|||||
| clang++ | clang++ -std=c++11 | g++ | g++ -std=c++11 | clang++ | clang++ -std=c++11 | |
| __cplusplus | 199711L | 201103L | 199711L | 201103L | 199711L | 201103L |
| __GXX_EXPERIMENTAL_CXX0X__ | undef | 1 | undef | 1 | undef | 1 |
| omit space in nested template ">>" | X | X | X | |||
| std::tr1::shared_ptr | X | X | X | X | X | X |
| std::shared_ptr | X | X | ||||
| nullptr | X | X | X | |||
| auto | X | X | X | X | X | |
| uniform initialization | X | X | ||||
| for range (foreach) | X | X | X | X | X | |
| move semantics (std::move) | X | X | ||||
| raw string literals | X | X | X | |||
| encoded string literals | X | X | X | |||
| noexcept | X | X | X | |||
| constexpr | X | X | X | |||
| variadic templates | X | X | X | X | X | X |
| lambdas | X | X | X | X | ||
| decltype | X | X | X | |||
| new function declaration style | X | X | X | |||
| scoped enums | X | X | X | |||
| std::function | X | X | ||||
| std::tr1::function | X | X | X | X | X | X |
| can autodetect need for std::tr1 | X | X | X | X | X | |
posted at 2012-10-06 19:54:21 US/Mountain
by David Simmons
tags: c++11 c++ c++0x
permalink
comments

