core.checkedint
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jun 24 20:19:52 PDT 2016
On 6/24/2016 6:42 PM, Andrei Alexandrescu wrote:
> With your suggestion, this would also be an overflow:
>
> long x = -1;
> auto y = array.length + x;
>
> I would be hard pressed to acknowledge that as an overflow that needs to be
> dynamically signaled. And the beauty of two's complement is that indeed it just
> works.
That's a seductive test case. But I worry that mixed signed/unsigned arithmetic
is not so simple.
What about:
x + array.length
commutativity in general
associativity
Does this become a morass of special cases?
More information about the Digitalmars-d
mailing list