The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Sharpen Your Instincts, Train Your Critical Thinking, and Learn the Tools That Help You Catch Bugs
25 real-world C++ cases explained in detail, covering lifetimes, integer promotion, data races and real-time safety for all levels of C++ developers.
Minimum price
$12.99
$19.99
About the Book
Sample available at bugs.cppdoctor.com
"This book walks you through some pitfalls and C++ caveats you usually only learn by getting bitten in production. My favorite was the one I thought would be an overflow but turned out to be an integer promotion. Those tips incidentally help write more secure code in many cases. An insightful and entertaining ebook from a C++ veteran. And it is compact enough to read in one sitting. Must read.” - Salem B.
"I have been working with C++ for many years, but the cases in this book taught me a bunch of things I never knew about the nooks and crannies of the language. Pair this book with your favorite compiler and explore them for yourself." - Brendan L.
Code that seems to work isn't the same as code that is guaranteed to work.
C++ hides more bugs than you might expect, and many of them depend on things around your code: the platform, the language version, the optimization level, and more.
25 C++ Cases That Will Humble You is a collection of 25 short C++ programs with a bug in them. Most of these cases I ran into in real-world projects, often in strange situations. Every case works in three ways:
Run it. Every case opens in Compiler Explorer, so you can compile it, change it and see for yourself what happens.
Spot the bug. Each case starts as a puzzle: a short program and a question. Can you find the bug before you read on?
Learn why. The explanation shows what really goes wrong, how to fix it, and often how tooling such as compiler warnings, sanitizers or static analyzers could have caught it. Along the way, I point to real-world projects that had the same bug.
You'll run into object lifetimes, lambdas, threads and data races, integral promotion, undefined behavior, real-time safety and more, and you'll see how the compiler, the platform and the C++ version can change what your code does.
The cases are independent, so you can read them in almost any order. The book is a compact PDF of 55+ pages.
Who is this for? C++ developers who think they know C++, and are ready to be humbled again. Veterans included.
Follow C++ Doctor at cppdoctor.com
About the Author
Jelle has been a C++ engineer for over a decade, contributing to a wide range of commercial products. He’s driven by a passion for writing high-quality code, and when he realized how many developers struggle to write good C++ code he founded C++ Doctor. Aiming to help others write clean, bug-free C++ through educational content delivered via newsletters, LinkedIn, eBooks and other products.
Jelle has spoken at the Audio Developer Conference, and is the author of The Anatomy of C++ Lambdas and 25 C++ Cases That Will Humble You. He’s also the founder of MPE HUB, a tool that brings MPE MIDI support to any synth.
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.