You Don't Have to Rewrite Everything in Rust to Get Memory Safety
Memory Safety for Skeptics – Queue
Rust cut memory-safety vulnerabilities by roughly 70% in production systems, but mass rewrites of stable C and C++ code are expensive and often misguided. This piece argues that legacy systems can pursue memory safety incrementally, within budget and schedule, by treating the transition as a business tradeoff rather than an aesthetic crusade. It defines what memory safety actually means and makes the case that the benefits are worth pursuing with or without Rust.
If anything, those calling for mass rewrites show their own inability to do the difficult work of understanding and working with an existing codebase that does a job and does it well.
- pseudony
I fail to see how this is anything but a reheat of the same old arguments.
Meanwhile, in the real world, from the author of curl:
> I know I’m repeating myself but: out of the 81 vulnerabilities we have confirmed in curl so far during 2026, 14 were the result of mistakes that most likely would have been avoided had we used a memory-safe language such as rust. That’s 17.3%.
https://daniel.haxx.se/blog/2026/11/17/actual-curl-rewrites-...
The article suffers from the usual issues - like jumping straight to the author’s favorite pet language- I absolutely would encourage fewer programs written in C++ and C (and Rust) - it is so rarely worth the risks to take on memory management by oneself.
But there will always be cases, and those usually involve strict performance requirements where RAII-style memory management (i.e. Rust) is a poor fit anyway.
- Surac
Memory safety is a nice thing if you have full control over all the code you use. But as long as there is a unsafe keeword neccersary it is futile. Any change in any unsave code may break all the nice borrow checking in only one call. I even think telling the user they are memory save but call unsafe code in the os layer is a extreme bad idea. Real memory safety needs a all or noting approach. I use rust binarys that fail with panics because something out if rusts scope goes wrong, mostly memory related
- loup-vaillant
I feel the need to recycle an older comment of mine: https://news.ycombinator.com/item?id=50620032
Now let's see the list they gave:
• Buffer overflow -> Bounds checks.
• Null pointer dereference -> Basically safe outside of embedded.
• Use after free -> Hard (temporal safety).
• Use of uninitialized memory -> Compilers already warn us.
• Illegal free -> Hard (temporal safety).
In broad strokes. I don't think current C compilers catch all uninitialised memory use. Having a variant that enforces it however is pretty easy. Bounds checks are similar. Proving the absence of overflow at compile time is impossible in the general case without proof assistance, but we can always have an incomplete analysis that inserts runtime checks when it's not sure. Same thing for null pointer dereference, just add a checks on systems that don't guarantee a safe segfault.
All those could easily be solved with a slightly modified C compiler already. Zig to name but one basically does it already. So we're left with the two hard ones: use after free, and illegal free. For those there are 3 well known solutions: garbage collection (a performance deal breaker in many cases), and borrow checking (a godsend or a pain in the butt, depending who you ask), and smart pointers (not quite safe in C++, but they do help a ton).
What's practically unheard of in the industry however are arenas. https://www.dgtlgrove.com/p/untangling-lifetimes-the-arena- […]
- Splizard
No mention of Fil-C?
- menaerus
> C and C++ won’t die, but they will likely decline and become legacy languages like Cobol or Ada.
Yes, any day now, the languages powering Linux, every major RDBMS, every distributed storage engine, every hypervisor, every browser engine, every AAA game engine, LLVM/GCC toolchains, and the embedded world are going to turn into COBOL - because Google wrote some Android Binder code in Rust, and a government working group published a PDF. For sure.
But if anything the "In Budget, On Schedule" section makes a surprisingly lucid case for why you shouldn’t rewrite working systems.