Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14 by Scott Meyers
My rating: 5 of 5 stars
Another book finished, another post to share. To say it out front, I wasn’t disappointed by this purchase and as you’ll shortly find out, that is reflected in my usual Goodreads review of it, which I also share here for convenience. Please enjoy.
This book is excellent. Perhaps I could stop right here, but this work is actually so good that it deserves a couple of more words, thus let’s get over with the obvious first. This book is not for those who got acquainted with C++ just yesterday. The author assumes you have some prior knowledge about the language, and as such, there will be no introductions whatsoever to any of the language features. On the other hand, the author doesn’t expect you to know everything there is to C++ either, so among other things, quite a lot of explanations about some deeper language mechanics will be presented (all of which you should know about anyway) to make sure you understand all the techniques and recommendations. So let’s get started.
The first few Items (topics?) of the book are all about making you understand some rather important language mechanics and terminology, e.g. type deduction for templates and auto, the real difference between the types of variable initialization, making a distinction between rhs and lhs values, etc. Later chapters build on the knowledge established here heavily, so expect to turn back here for some refreshers a couple of times. The book then continues with the presentation of modern or revised features of C++ introduced with the 2011 and 2014 standards and why these should be preferred over the old C++98 style solutions. The really neat thing about these, is that where there is an actual difference between C++11 and C++14 solutions, both of them are presented. The book also never falls short of explaining underlying language mechanics and the pitfalls associated with them for any of the new or old approaches, so it never preaches. It deliberates. Fortunately, this methodology of explaining persists till the end.
The second half of the book is then mostly concerned about move semantics, references, forwarding and lambdas. What I truly liked about these, is that even if you didn’t use the aforementioned features frequently, you would probably still become closer friends with them, mainly thanks to the length and detail of the discussions. The second to last chapter made my head scratch a bit, as it discussed concurrency in such a casual way, as if some people were discussing yesterday’s weather. As I have mentioned in the first paragraph, the author really does assume prior knowledge, but this assumption is triply true for concurrency. Unless you have some hands on knowledge of this topic or read Anthony Williams’ book on C++ concurrency (which was actually cited here), it will be really hard to make use of this chapter. And this would be my only complaint about the entire book if I was pressed hard to come up with one, but to be frank, I still wouldn’t call it a complaint, as the author never set this book up to be any kind of intro to anything.
So all in all, I’m really satisfied with this book and I would definitely recommend it to anyone who at least has a basic knowledge of C++. Those, who just started out with C++ recently on the other hand, shouldn’t defer themselves from buying this book either, as it will come in handy soon enough and they will be glad to have this prepared on their bookshelves when the time comes.
As always, thanks for reading.