Re:C’s Biggest Mistake (2009)
by Skunkleton on Saturday September 12, 2020 @11:02PM
(#24457911)
Bounds checking is a solved problem in C. The challenge is proving that your program _cannot_ go out of bounds. That is very much not a solved problem in C.
I'm curious what you'd want the automatica bounds checking to do?
Just terminating the program won't be much better than OOB memory access in many cases.
Continuing but discarding OOB writes/use a dummy for OOB reads could lead to much worse behavior.
An exception (or setting errno since this is C) would need that exception to be handled somewhere in a sensible way in which case you could just as easily add manual bounds checking.
If you're worried about performance test it and turn it off.