REVIEW - The C++ Programming Language - 4th Edition


Title:

The C++ Programming Language

4th Edition

Author:

Bjarne Stroustrup

Publisher:

Addison-Wesley Professional (2013)

Pages:

1361pp

Reviewer:

Alan Lenton

Reviewed:

April 2014

Rating:

★★★★★


Note: review does not contain explicit recommendation.

Reviewed: January 2014

This is not a book for novice programmers. It’s also not a book about the differences between C++98 and C++11. Neither is it a traditional style tutorial or just reference book, though it has an index good enough to make it usable as such.

So what is it then? Its avowed purpose is to provide intermediate and advanced C++ programmers with a thorough grounding in modern C++ defined as being post 2011 ISO standard. The book makes few concessions to how things were done in C++98, its purpose is to show you how they should be done in C++11. The book is divided into four main parts – ‘A Tour of C++’, ‘Basic Facilities’, ‘Abstraction Mechanisms’, and ‘The Standard Library’. I’ll look at each of them in turn.

The first section is, at first sight, a bit odd. It’s a 100-page rapid look at how things fit together in C++ without going into too much detail at any point. I wasn’t sure at first, but after a while I realized that I could start to see how the new facilities would be used, even though the setting was relatively simple.

You can do this sort of thing when you write for developers who already use the language, because you don’t have to worry about using common facilities that haven’t yet been formally introduced. Some people may not like it, but if it’s not your cup of tea it can be skipped without causing too many problems later on.

In the second part we start to cover the basics in more detail. I found the section on references particularly useful, covering, as it does, both lvalue and rvalue references. As readers probably know rvalue references were introduced in the latest standard, but their treatment in this book is typical of the treatment all the way through – as part of a whole, not something bolted on afterwards.

One thing this section has that I haven’t seen in most books is a chapter on source files and programs which covers not only linkage, but headers, ODR, and initialization.

The third part covers abstraction mechanisms – broadly speaking classes, templates, generic programming and metaprogramming. Much of the material in this section is hard work. That’s not the fault of the author. He is dealing with complex, abstract, concepts which require concentration to understand. You can’t simplify them, or you lose the essence of the ideas. Be prepared to give the material your undivided attention, or you will get lost.

The fourth and final part of the book covers the Standard Library. It’s only about 400 pages long (though I have whole books shorter than that!) but it’s packed with useful material ranging over the whole library. The problem is that the library is big, and this is perhaps the one place where you will find it necessary to have some more specialist books on your shelf in addition to this one.

It’s not that there is anything wrong with the section. Quite to the contrary, there is much in it that is excellent, but it just doesn’t have the space to cover everything with enough examples. The most obvious need is in the concurrency chapters. The library concurrency material is all there, but there simply isn’t space to deal in depth with how to use it safely. I think that the part of my programming shelf dealing specifically with C++ will not only have this book on it but also The C++ Standard Library by Nico Josuttis and C++ Concurrency in Action by Anthony Williams.

Overall there are a couple of things which I particularly liked. One is the ‘Advice’ sections at the end of each chapter, one or two liners which make some suggestions about the best way to go about doing the things covered in the chapter. They aren’t proscriptive but they represent good advice to bear in mind.

Second, I, for one, found particularly useful the brief examples given in the book. The way they are constructed makes no concessions to pre­C++11 code, and shows how one of the minds behind the standard intended the new material to be used. I’m sure that some of those who follow the work of the standards bodies closely will recognize echoes of arguments in some of the book’s explanations of various features!

I got a lot out of this book. More than I expected, and I suspect I’m a better programmer for that. I would be careful who I recommend it to, because, as I said at the start of this review, it’s not for beginners.

Coda: This book is physically heavy. It’s 1,300+ pages, including the index (which as I said earlier, is good enough to make it useful as a reference). I have the paperback edition, I imagine the hardback is even heavier. There have been reviews suggesting that the book is not well constructed. I carried it back and forth to work on the tube (subway) and train for a month, and it’s still fine, a little battered, perhaps, but certainly not coming apart. I think that any early problems there may have been must have been fixed.

If you are considering purchasing the Kindle edition you should be aware that there are both tables and diagrams in the book, something I’ve found are often not handled all that well in electronic readers.


Book cover image courtesy of Open Library.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.