[OT] The Usual Arithmetic Confusions

Walter Bright newshound2 at digitalmars.com
Fri Feb 18 08:05:43 UTC 2022


On 2/17/2022 9:25 PM, Timon Gehr wrote:
> Except perhaps for somewhat long arrays in a 32-bit program.

Can't have everything.

If you've got an array length longer than int.max, you're going to have trouble 
distinguishing a subtraction from a wraparound addition in any case. Dealing 
with that means one is simply going to have to pay attention to how integer 2-s 
complement arithmetic works on a computer.

Just wait till you get into floating point!


More information about the Digitalmars-d mailing list