3 ms·
> In my view it doesn't really matter. One of these days, the compiler will do something surprising to one of your expressions involving signed integer overflo
by nayuki 4y ago
> In my view it doesn't really matter.
One of these days, the compiler will do something surprising to one of your expressions involving signed integer overflow, like converting x < x + 1 to true. Or it'll delete a whole loop because it noticed that your code is guaranteed to trigger an out-of-bounds array read, e.g.: https://devblogs.microsoft.com/oldnewthing/?p=633 https://devblogs.microsoft.com/oldnewthing/?p=633
> If you do that you'll be fine.
I would not trust code written based on the methodology you described. However, if you also add -fsanitize=undefined,address (UBSan and ASan) and pass those tests, then I would trust your code.
- rwmj 4y agoYes we do use the sanitization options too.