C++11, the current standard
At NCIM (www.ncim.nl) we organize NCIM TechTalks where one the NCIM developers gives a briefing about a work related topic. Last week Ralph Langendam (http://www.linkedin.com/pub/ralph-langendam/26/1b9/53b/nl) gave an update on the current C++11 standard.
In 1979 Bjarne Stroustrup (http://en.wikipedia.org/wiki/Bjarne_Stroustrup) started working with C with classes which evolved to C++ in 1983. By then features like virtual functions, exceptions, function overloading, const and references were added. In 1985 Stroustrup published his book “The C++ Programming Language”. In 1998 the C++ language was standardized by ISO in C++98 and STL was added to the language. The language evolved into the C++03 version. In 2005, TR1 (Technical Report 1) with features of C++0x was created. It was mainly driven by developments of the Boost community (www.boost.org). Both C++0x and the Boost library evolved in the current C++11 standard which was approved by ISO on 12 august 2011.
High level development goals
The following items were considered when developing the new standard:
- It should be backwards compatible with C++98 and C.
- It should extend primarily through STL and less through the C++ core language
- It should focus on programming techniques, systems and library design
- It should improve on it strengths like type safety, performance and ability to work directly with hardware,
- It should implement the ‘zero overhead principle’ by setting up the STL in a more modularized fashion.
- It should strive to make C++ easier to learn for new developers.
Enhancements to the C++ language
The following enhancements were highlighted by the presentation:
- Move semantics
- R-value references
- Constant expressions
- Static assertions
- Type inference
- Anonymous functions
- Lambda expressions
- Override and final modifiers
- Alias templates
- Strongly typed enumerations
- Unrestricted unions
- Variadic templates
- Defaulted and deleted special methods
- Threading facilities
- Smart pointers (RAII*)
- Type traits for TMP**
* RAII = Resource Acquisition Is Initialization
** TMP = Template Meta Programming
The Presentation covers the above mentioned topics with small examples
C++11 covers approximately 40 subjects. MSVC 2012 supports about half of them while GCC 4.8 and CLang 3.1 are almost feature complete.
C++ Reference http://en.cppreference.com/w/
ISO C++ http://isocpp.org/
C++ 11 Compiler support http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport
C++ 11 Wiki http://en.wikipedia.org/wiki/C%2B%2B11