[OT] The Usual Arithmetic Confusions

Siarhei Siamashka siarhei.siamashka at gmail.com
Sat Jan 29 01:06:45 UTC 2022

On Friday, 28 January 2022 at 18:39:54 UTC, deadalnix wrote:
> The other ones really banal wrap around behavior, which your 
> really can't do without if youw ant to make anything fast, IMO.

Modern programing languages tend to have separate operators or 
intrinsincs for wrapped and non-wrapped (trap on overflow) 
arithmetic operations. In the vast majority of cases having an 
arithmetic overflow is a bug in the code. And being able to catch 
such bugs is as useful as having bounds checking for arrays. I 
think that it's only a matter of time until processors start 
adding the missing instructions to make this fast. That's a 
typical chicken/egg problem. If Rust language becomes really 
popular, then the hardware will adapt.

More information about the Digitalmars-d mailing list