core.checkedint
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jun 24 18:49:22 PDT 2016
On 06/24/2016 09:42 PM, Andrei Alexandrescu wrote:
> 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.
To clarify: if array.length is 0, then indeed that should be signaled as
an error. But otherwise it should just go through, no overflow. -- Andrei
More information about the Digitalmars-d
mailing list