[OT] The Usual Arithmetic Confusions

Dukc ajieskola at gmail.com
Thu Feb 3 20:56:04 UTC 2022


On Thursday, 3 February 2022 at 18:07:43 UTC, Ola Fosheim Grøstad 
wrote:
>
> I advocated trapping overflows except where you explicitly 
> disable it.

I don't know if you meant to do it the C++ way (unsigned 
overflows normally, signed may do anything on overflow), or some 
other way. Regardless, probably a bad idea. We could allow 
undefined behaviour only in `@system` code, and realistically, 
where would you want integers that behave that way? You're 
supposed to be a bit desperate before you disable safety features 
for performance, at that point you have probably already 
hand-optimised away the code that the compiler could remove for 
you.


More information about the Digitalmars-d mailing list