Hi r/cplusplus!
Stjepan from Manning here. The mods have given us permission to share Memory Safe C++: How to Write Safety-Critical Software by Jean Frantz René, now in Manning’s Early Access Program (MEAP).
Code compiles cleanly, passes the tests, and gets through a general-purpose lint check. How much confidence should that actually give you about memory safety?
That’s the starting point for the book’s case studies. You investigate apparently healthy C++ code, find the hidden defect, trace what happens at the machine level, and work through competing fixes.
The useful part is getting beyond “here’s the corrected code.” Each case study compares working solutions on memory use, determinism, compliance, and remaining risk. The goal is to help you recognize similar defects in your own code and explain why a particular fix fits your constraints.
For anyone curious about the lower-level details, that includes examining stack frames, how function prologues change between optimization levels, and what a sanitizer’s shadow state records. There’s a companion repository so you can run the examples yourself.
The book is aimed at readers who already know C++ and want to move toward safety-critical work. It also connects implementation decisions to MISRA C++:2023 and the requirements of industries where a failure can cause physical harm.
It’s still being written: MEAP gives you access to chapters as they become available, plus the finished ebook when it’s ready.
https://www.manning.com/books/memory-safe-c-plus-plus
GIVEAWAY:
We’re giving away 5 free ebook copies, one each to five commenters who contribute most thoughtfully to the discussion. We’ll choose based on the substance of the contribution, not upvotes or whether you say something positive about the book. A useful question, a well-explained disagreement, or an experience others can learn from all count. No purchase necessary.
For everyone else, Manning is also providing the community 50% off the book with code MLRENE50RE at checkout.
To get the discussion going: what’s a C++ memory-safety bug that slipped past your tests or code review? What finally exposed it—and did the fix introduce any trade-offs you hadn’t expected?
If you’re still learning, what part of memory safety do you find hardest to reason about? Thoughtful questions are welcome too.
Thank you for having us here.
Cheers,
Stjepan