I wrote a C++ book!


I’m very proud to announce that my first book just got released on The Pragmatic Programmers! The book is called “C++ Brain Teasers“, and is part of their Brain Teasers series.

The book consists of 25 short C++ programs, and the point is to guess what the output is, and why the language works like that. Much like CppQuiz.org, except with more elaborate and well-written explanations explaining the underlying principles of the language. The puzzles were also selected to be more cohesive and relevant to real-world uses, and the explanations include lots of practical tips to write better and safer code in practice. So the book can be read just for fun or as a deeper learning opportunity, and maybe you can keep a few copies for entertainment around the office?

From the marketing blurb:

C++ is famous for getting all the default behaviors wrong and for sometimes making demons fly out of your nose. Through 25 puzzles, from the useful to the outright weird, we explore some of C++ ‘s most interesting quirks. How does initialization actually work? Do temporaries even exist? Why is +!!”” a valid expression in C++ ? As you work through each puzzle, you will peel off some of the layers of complexity of C++ , getting a fundamental understanding of how the language works. This will help you write better code and recognize issues more easily while debugging.

The book is available both in paperback and as an e-book, and can be purchased from the publisher or wherever you normally buy books. You can even download the preface and three full chapters for free, with no registration needed! I find it especially cool to be published on The Pragmatic Programmers, as “The Pragmatic Programmer” was an important and transformative book early on in my career. I even got support from Dave Thomas himself at one point! 🤩

Finally, a big thank you to Frances Buontempo for introducing me to the publisher, and to my amazing technical reviewers Daniela Engert, Björn Fahller, Olve Maudal, Karthik Nishanth, Tom Schultz, Tina Ulbrich, Sergei Vasilchenko, and Piotr Wierciński!

Happy reading!

Leave a comment