Could we make C arrays memory safe? Probably not, but let’s try anyway

This blog post discusses a scheme that aims to improve computer security by making the C programming language somewhat safer. The author acknowledges that similar ideas have been proposed in research papers, but no full-scale implementation for C has been done. The post presents a simple C function and demonstrates how to make it memory safe by adding a conditional check. The author proposes a new syntax to inform the compiler about the size of an array, allowing it to verify safety. The scheme is compared to Rust’s borrow checker. Further examples and complexities are discussed, highlighting the limitations of the scheme when the size of the array can change.

https://nibblestew.blogspot.com/2023/10/could-we-make-c-arrays-memory.html

To top