Memory-safe C code
Memory-safe C code
Posted Nov 16, 2025 17:30 UTC (Sun) by khim (subscriber, #9252)In reply to: Memory-safe C code by alx.manpages
Parent article: Rust in Android: move fast and fix things (Google Security Blog)
> it does proof, to some extent
It's like saying that someone is “pregnant, to some extent”. You either do proof or you don't do it. And C/C++ don't do it. Period.
> You can write C code where you know the compiler will prove you won't trigger most cases of UB.Yes, but you can not teach compiler to reject code that triggers UB. That's fundamental difference.
> I'm working specifically on a GCC patch with which you can write C functions where the compiler can prove you won't do any buffer overflows.That's nice, but the problem with that approach is that, in the end of the road, you wouldn't have C, you would have some other language that can be compiled with C compiler.
If such thing would have been created 20 or even 10 years ago it would have been very interesting, but today… Rust already exist.
The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:
Note: you can avoid this step in the future by logging into your LWN account.
