3 ms·
I agree with all you wrote. Indeed full C array out of bounds checks or avoidance would not the way to go, for reasons you mentioned. Not to mention so many oth
by nuancebydefault 3y ago
I agree with all you wrote. Indeed full C array out of bounds checks or avoidance would not the way to go, for reasons you mentioned. Not to mention so many other modes of memory unsafety. But it is not exactly the point I tried to make. In the example code the article presents, there was an opportunity for C to improve the language to make it safer. Instead, the compiler writers decided to make sure this unwanted optimization would not happen by making the compiler more clever and hence heavier, so as to avoid this particular case of UB when using an improved compiler. Still, the C/C++ committee would wave away any critique with: don't use this language in the wrong (UB) way and complain.