Recommended with reservations.
This could have been the next ‘Meyers’ C++ book. However, it has one problem. A big problem. It is just too big. I was really enthusiastic when I started reading. Bite-sized chunks well written by experts. Great, I thought.
Then the bite-sized chunks started getting bloated. Instead of say 5 pages for a topic, sections started hitting double, then triple digit page counts. Probably the worst offender is the section on Generalized PODs ‘11. Or PODzzzz I should say. A few times I had that experience that I imagine a few readers of this review will have experienced. You get to the end of a page and you realise that your attention had wandered and none of it sank in. So you read it again, and again your concentration evaporates. After the third try you just give up.
Not helping much is that one of the authors has a beehive in his bonnet about narrow interfaces. So we get not one but two sections on noexcept
(the Operator and the Specifier). Adding to the page count are a large glossary (occasionally useful if you are not fully up to steam with C++ acronyms) and a lengthy bibliography.
The book is split into 3 sections, Safe, Conditionally Safe and Unsafe features. Each of these is split into smaller sections, about 50 or so. There are fewer Unsafe sections than the other two. I suppose that means that C++ must have been doing most things right(-ish). I’ll just list a few in each category as a taster. Safe: nullptr
, override
and using
aliases. Conditionally safe: braced init
, range for
and auto
variables. Unsafe: noexcept
(of course) and final
(too restrictive).
Getting back to a couple of those sections. nullptr
is a bit over 4 pages long. Excellent! Generalized PODs bangs on for 134 pages. The section describes several different categories of user defined types (PODs, aggregates, trivially copyable etc.). It then goes into painful detail as to what exactly constitutes each of these categories with endless code snippets with comments explaining why it is or isn’t of the given category and what you can and cannot do with that type. I can see that compiler writers need to know this stuff so that they can use functions like memcpy
for faster copying. For any normal C++ developer, there is far too much detail.
There are a couple of ‘guest chapters’ by Andrei Alexandrescu (far beyond my template pack abilities) and Sean Parent (on the performance impact of the C++ standard requirements on moved-from objects).
Who is going to benefit from this book? It’s not really a learning book (unless you are planning on joining the C++ committee or becoming a compiler writer or both). The shorter sections stand up well as references. I can’t see anyone wading through the 100+ pages on noexcept
just to check on some detail. I don’t know of any similar book, so I suppose that it could be considered to be a flawed reference.
Maybe this book will grow on me (like Stroustrup’s C++ Programming Language). The quality is definitively in there somewhere.
Code: https://emcpps.com/