Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> being able to cast ints to pointers are fundamentally insecure

Your compiler could track those ints used as pointers all the way throughout the whole program and prevent out of bound values either at compile time or at runtime for compatibility. There is nothing fundamental about C that makes it incompatible with memory safety.



Well, yeah, but then you'd basically - eventually - end up with Rust... not C!


Which was kind of my point. In order for the compiler to have the info it needs to properly track everything and prevent unsafe things from happening you need to extend the language to provide enough context for the compiler to work with. Once you do that you've basically arrived at Rust (or something very much like it).


The compiler has the info it needs already, you don't need to change C to make it memory safe. I even posted a link to a working memory safe C compiler, that preserves complete compatibility. The only downside, at least initially, is that you have to sacrifice some of the performance. And with enough resources pouring into the compiler you can get most of that performance back eventually.


Or Cyclone, Vault, Clay, SAFEcode, or Softbound+CETS that are either C variants or protect legacy C. Rust is a totally separate topic and style. I'd push Modula-2 with C-like syntax on C programmers before Rust.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: