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?

Reply via email to