Navigation



B.1 — Introduction to C++11

What is C++11?

On August 12, 2011, the ISO (International Organization for Standardization) approved a new version of C++, called C++11. C++11 adds a whole new set of features to the C++ language! Use of these new features is entirely optional — but you will undoubtedly find some of them helpful. We will only cover a portion of the new features here (those you are mostly likely to actually use).

Note that because C++11 is new (as of the time of writing), only modern compilers support it, and most of them only support it partially. I’ll be using Visual Studio 2010 Express Edition for sample code. Compatibility with other compilers may vary. If you are using an older version of Visual Studio, now’s a good time to upgrade to Visual Studio 2010 Express, even though it’s support for C++11 is spotty at best at the time of writing.

The goals and designs of C++11

Bjarne Stroustrup characterized the goals of C++11 as such:

  • Build on C++’s strengths — rather than trying to extend C++ to new areas where it may be weaker (eg. Windows applications with heavy GUI), focus on making it do what it does well even better.
  • Make C++ easier to learn, use, and teach — provide functionality that makes the language more consistent and easier to use.

To that end, the committee that put the language together tried to obey the following general principles:

  • Maintain stability and compatibility with older versions of C++ and C wherever possible. Programs that worked under C++03 should generally still work under C++11.
  • Keep the number of core language extensions to a minimum, and put the bulk of the changes in the standard library (an objective that wasn’t met very well with this release)
  • Focus on improving abstraction mechanisms (classes, templates) rather than adding mechanisms to handle specific, narrow situations.
  • Add new functionality for both novices and experts. A little of something for everybody!
  • Increase type safety, to prevent inadvertent bugs.
  • Improve performance and allow C++ to work directly with hardware.
  • Consider usability and ecosystem issues. C++ needs to work well with other tools, be easy to use and teach, etc…

Since C++11 isn’t a large departure from C++03, it really doesn’t need any more introduction. We’ll just dive right into the new features in the next lesson.

B.2 — Long long, auto, decltype, nullptr, and enum classes
Index
A.6 — Fixed-width integers

5 comments to B.1 — Introduction to C++11

You must be logged in to post a comment.