3 ms·
Given the vast amount of C/C++ around, much which will never be rewritten, I wonder if bounds checking compilers should be considered?
by rwmj 3y ago
Given the vast amount of C/C++ around, much which will never be rewritten, I wonder if bounds checking compilers should be considered?
- afdbcreid 3y agoBounds checking will sure solve some of the problems, but it will not solve all of them, perhaps not even most of them. You'd still got: UAF, iterator invalidation, etc.. And not even all code can be bounds checked, you need to know the length for that (which means using new types such as std::span or having to annotate your functions with a compiler attribute, to be able to also bound-check pointers).
- UncleMeat 3y agoBounds checking is also frustratingly expensive because of C++'s horrible aliasing rules meaning that compilers struggle to soundly eliminate redundant bounds checks.
- amai 3y agoIt will be rewritten by generative ai soon.
- petabyt 3y agoWe've had bound checks and address sanitizers in most C compilers for years now at this point (gcc, tcc, clang)
- rwmj 3y agoI know, I wrote the first one for GCC.