Highly recommended (with a few reservations).
This is a slender book. As a rule, book prices don’t scale linearly but it does seem to be expensive for what you get (over 3 times the price per page compared to the last review I sent and that was for a hardback book). Adding to the light weight is the fact that the puzzles all start on a right page (so that you can’t see the answer without turning the page, which is fair enough).
My first real annoyance was that the source code would not build. I followed the instructions on page xiv on both FreeBSD and Linux. A couple of the examples use threads indirectly and the cmake file doesn’t do anything to link with a thread library. So I opened a GitHub issue. Rather than trying to reproduce the problem, the author persisted in saying that it works in the GitHub continuous integration. Am I sure? Is it a FreeBSD issue? Has GCC changed? Clearly Knatten doesn’t have a clue how link editors work on UNIX like systems using ELF. I also opened a pull request which eventually got merged so you shouldn’t have this problem.
On to the book itself. I read it in a very different way compared to how I usually read books. At work we have a weekly meeting on Fridays, which are usually open to any technical subjects that are reasonably work related. So, over a couple of months, I presented questions from this book at a rate of about 3 items per approx 30 minute meeting. The book contains 25 puzzles that all fit on one page. Each puzzle is followed by a longer discussion of around 2 or 3 pages. Despite the appearances, all of the code compiles. Prior to the meetings I looked at the code but deliberately avoided reading the answers. Usually we were able to work through what was going on, but sometimes I would add clarifications from the book’s discussions the next week.
There is no real theme to the puzzles, though there is some continuity between a few of them. I don’t want to give away anything to people that would like to read the book. If you know the warts of C++ reasonably well then there aren’t too many surprises – implicit conversion shockers, arcane function resolution, order of evaluation and the odd case of UB. One more quibble. A couple of the puzzles mention the fact that the C++ standard gives considerable flexibility regarding the size of integral types. For me that is a non-issue unless you are developing software for a computer museum or maybe some embedded systems.
Website: https://pragprog.com/titles/akbrain/c-brain-teasers/
Code Site: https://github.com/knatten/cpp-brain-teasers