Jump to ratings and reviews
Rate this book

How Not to Program in C++: 111 Broken Programs and 3 Working Ones, or Why Does 2+2=5986

Rate this book
Find the bugs in these broken programs and become a better programmer. Based on real-world errors, the puzzles range from easy (one wrong character) to mind twisting (errors with multiple threads). Match your wits against the author's and polish your language skills as you try to fix broken programs. Clues help along the way, and answers are provided at the back of the book.

280 pages, Paperback

First published March 28, 2003

3 people are currently reading
47 people want to read

About the author

Steve Oualline

32 books4 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
5 (21%)
4 stars
10 (43%)
3 stars
6 (26%)
2 stars
1 (4%)
1 star
1 (4%)
Displaying 1 - 3 of 3 reviews
1 review
June 30, 2025
One of my favorite books! I love all the stories of software gone wrong, clever hacks, and captured cyber criminals.

It's also an excellent book for sharpening your debugging skills. I tell people about this book all the time, saying it's "a programmer's puzzle book", and I really enjoyed trying to find the issues with each program without the help of a debugger.
Profile Image for Gaelan D'costa.
207 reviews14 followers
January 21, 2010
I almost want to consider this essential reading for 'real C++ programming.'

The exercises aren't about bad programming practice, they instead are about highlighting common misunderstandings about what certain C++ phrases actually mean, and how C++'s hands-off approach to system internals sometimes bites you.

Some of the hints were frustrating, but mostly because they were stressing the system-dependant nature of portability and lower-level issues. Most of the time, by the second or third hint I had enough clues to figure out what was going on.

I couldn't find source files online, which was disappointing ... not all of the code fragments would have been best attacked via compiler and debugger, but having the opportunity to do so conveniently would have been nice.

There were chapters on portability and concurrency, which make for good primers on underrated but very imporant subjects in general. It's not the book's job to introduce further resources on the subjects, but some explicit emphasis on the importance of the subjects would have been nice (although I suppose you could say that having ful chapters on the subject would imply this.)
Profile Image for Eric.
31 reviews2 followers
June 24, 2011
This book contains a bunch of counterexamples of proper C++ programs. The programs contain bugs ranging from novice-level to truly arcane. While some of the "puzzles" were quite easy, others involved parts of the C++ language that I hadn't used before, and I learned quite a bit from these.

Overall, it was a good book to pick up for a couple of minutes at a time while waiting for code to build.
Displaying 1 - 3 of 3 reviews

Can't find what you're looking for?

Get help and learn more about the design.