3 ms·
What new category? The article discusses the choice between having signed integer overflow as an implementation-defined and undefined behavior. And it says if i
by menaerus 3y ago
What new category? The article discusses the choice between having signed integer overflow as an implementation-defined and undefined behavior. And it says if it had been implementation-defined, it wouldn't be an error and hence UB sanitizer would not be able to catch it anymore.
With signed integer overflow being the UB, sanitizers are able to catch them regardless of the level of optimization you apply to your code. "Debug" or "release".
And what you propose, and what I think Rust does, is in no way better because "something more efficient" is ambiguous at its best. I wonder what would that be considering that is a condition that you certainly _want_ to catch. I think the reason why Rust did it this way (by panicking on the overflows in non-optimized builds) is because it does not have support for sanitizers (yet).
- UncleMeat 3y agoThe new proposed category is "erroneous behavior", which allows for the sort of "this code is wrong so I refuse to compile" errors while also encouraging a sort of "I will at least treat this consistently if I compile it" behavior from the compiler. It remains to be seen whether or not the committee will accept any papers with this new category.