Chapter 13. C++

C++ was created by Bjarne Stroustrup in 1983 as an extension of C with the object oriented concepts of Simula-67. The first commercial compiler (a preprocessor generating C code) was released in 1985. During the the following years, many features were added or improved. The stardardization started in 1989 and the first official ISO/ANSI C++ standard was published in 1998.

In contrast to Objective C, C++ is a big extension of C. It almost doubles the number of keywords with the implied increase in complexity (probably growing exponentially with the number of keywords). C++ not only adds object oriented features to C, but also a number of unrelated extensions such as references, type parameters (templates), operator overloading, default arguments, and so forth. To further complicate our presentation, even a small program uses almost all these features together (at least as soon as you use the standard library). This makes it hard to explain our examples without getting lost in the details. This tendency is not restricted to our presentation, but is something every C++ developers has to be aware of.

13.1. Software and Installation

As for C and Objective C, we use the GNU compiler gcc, version 3.3, for the examples in this chapter.

Bibliography

The definite guide to C++ is not surprisingly [STROUSTRUP00]> written by the inventor of the language. Besides the documentation of the language features it reveals the reasoning behind it. Scott Meyers' provides a lot of insights which a C++ programmer otherwise has to learn through painful experience. The documentation of the boost library contains a good introduction to template metaprogramming.

Bjarne Stroustrup, 0201700735, Addison-Wesley, 2000, The C++ Programming Language, Special Edition.

[Meyers97] Scott Meyers, 0201924889, Addison-Wesley, 1997, Effective C++, 2nd edition: 50 Specific Ways to Improve Your Programs and Designs.

[Meyers95] Scott Meyers, 020163371X, Addison-Wesley, 1995, More Effective C++: 35 New Ways To Improve Your Programs and Designs.

[Eckel03] Bruce Eckel, 0139798099, Prentice Hall, 2002, Thinking in C++, 2nd edition.

[Gurtovoy] Aleksey Gurtovoy and David Abrahams, http://www.boost.org/libs/mpl/doc/paper/html/index.html , The Boost C++ Metaprogramming Library.