Reference Style – All Levels
1. The C++ Programming Language
(Bjarne Stroustrup) The classic introduction to C++ by its creator. Written to parallel the classic K&R, this indeed reads very much alike it and covers just about everything from the core language to the standard library, to programming paradigms to the language’s philosophy. (Thereby making the latest editions break the 1k page barrier.) [Review]
C++ 11 References:
1. The C++ Standard (INCITS/ISO/IEC 14882-2011) This, of course, is the final arbiter of all that is or isn’t C++. Be aware, however, that it is intended purely as a reference for experienced users willing to devote considerable time and effort to its understanding. As usual, the first release was quiteexpensive ($300+ US), but it has now been released in electronic form for $30US — probably the least expensive of the reference books listed here.
2. Overview of the New C++ (C++11) While this claims to be an overview rather than a reference, it’s nearly the only book devoted to C++11 that’s currently available. Fortunately, it’s by Scott Meyers, who’s a highly respected author on C++. Even though the list of items is short, the quality is high.
If you are new to programming or if you have experience in other languages and are new to C++, these books are highly recommended.
1. C++ Primer
† (Stanley Lippman, Josée Lajoie, and Barbara E. Moo) Coming at 1k pages, this is a very thorough introduction into C++ that covers just about everything in the language in a very accessible format and in great detail. [Review]
The fifth edition covers C++11.
2. Accelerated C++
(Andrew Koenig and Barbara Moo) This basically covers the same ground as theC++ Primer
, but does so on a fourth of its space. This is largely because it does not attempt to be an introduction to programming
, but an introduction to C++
for people who’ve previously programmed in some other language. It has a steeper learning curve, but, for those who can cope with this, it is a very compact introduction into the language. (Historically, it broke new ground by being the first beginner’s book using a modern approach at teaching the language.) [Review]
3. Thinking in C++
(Bruce Eckel) Two volumes; second is more about standard library, but still very good
1. Effective C++
(Scott Meyers) This was written with the aim of being the best second book C++ programmers should read, and it succeeded. Earlier editions were aimed at programmers coming from C, the third edition changes this and targets programmers coming from languages like Java. It presents ~50 easy-to-remember rules of thumb along with their rationale in a very accessible (and enjoyable) style. [Review]
2. Effective STL
(Scott Meyers) This aims to do the same to the part of the standard library coming from the STL what Effective C++
did to the language as a whole: It presents rules of thumb along with their rationale. [Review]
1. More Effective C++
(Scott Meyers) Even more rules of thumb than Effective C++
. Not as important as the ones in the first book, but still good to know.
2. Exceptional C++
(Herb Sutter) Presented as a set of puzzles, this has one of the best and thorough discussions of the proper resource management and exception safety in C++ through Resource Acquisition is Initialization (RAII) in addition to in-depth coverage of a variety of other topics including the pimpl idiom, name lookup, good class design, and the C++ memory model. [Review]
3. More Exceptional C++
(Herb Sutter) Covers additional exception safety topics not covered inExceptional C++
, in addition to discussion of effective object oriented programming in C++ and correct use of the STL. [Review]
4. Exceptional C++ Style
(Herb Sutter) Discusses generic programming, optimization, and resource management; this book also has an excellent exposition of how to write modular code in C++ by using nonmember functions and the single responsibility principle. [Review]
5. C++ Coding Standards
(Herb Sutter and Andrei Alexandrescu) “Coding standards” here doesn’t mean “how many spaces should I indent my code?” This book contains 101 best practices, idioms, and common pitfalls that can help you to write correct, understandable, and efficient C++ code.[Review]
6. C++ Templates: The Complete Guide
(David Vandevoorde and Nicolai M. Josuttis) This is the
book about C++ templates. It covers everything from the very basics to some of the most advanced template metaprogramming and explains every detail of how templates work (both conceptually and at how they are implemented) and discusses many common pitfalls. Has excellent summaries of the One Definition Rule (ODR) and overload resolution in the appendices. [Review]
1. Modern C++ Design
(Andrei Alexandrescu) A groundbreaking book on advanced generic programming techniques. Introduces policy-based design, type lists, and fundamental generic programming idioms then explains how many useful design patterns (including small object allocators, functors, factories, visitors, and multimethods) can be implemented efficiently, modularly, and cleanly using generic programming. [Review]
2. C++ Template Metaprogramming (David Abrahams and Aleksey Gurtovoy)
3. C++ Concurrency In Action (Anthony Williams) A book covering C++-11 concurrency support including the thread library, the atomics library, the C++ memory model, locks and mutexes, as well as issues of designing and debugging multithreaded applications.
Classics / Older
Note: Some information contained within these books may not be up to date or no longer considered best practice.
1. The Design and Evolution of C++
(Bjarne Stroustrup) If you want to know why
the language is the way it is, this book is were you find answers. This covers everything before the standardization
3. Advanced C++ Programming Styles and Idioms
(James Coplien) A predecessor of the pattern movement, it describes many C++-specific “idioms”. It’s certainly a very good book and still worth a read if you can spare the time, but quite old and not up-to-date with current C++.
4. Large Scale C++ Software Design
(John Lakos) Lakos explains techniques to manage very big C++ software projects. Certainly a good read, if it only was up to date. It was written long before C++98, and misses on many features (e.g. namespaces) important for large scale projects. If you need to work in a big C++ software project, you might want to read it, although you need to take more than a grain of salt with it. There’s been the rumor that Lakos is writing an up-to-date edition of the book for years.
5. Inside the C++ Object Model
(Stanley Lippman) If you want to know how virtual member functions are commonly implemented and how base objects are commonly laid out in memory in a multi-inheritance scenario, and how all this affects performance, this is where you will find thorough discussions of such topics.