[Issue 10124] Array length increases on subtraction of a big number instead of throwing RangeError
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Aug 31 23:44:08 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=10124
Marco Leise <Marco.Leise at gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |Marco.Leise at gmx.de
--- Comment #3 from Marco Leise <Marco.Leise at gmx.de> ---
I see it like the others, Denis. Detecting overflow/underflow here is no
different than on regular integer math in other places. The compiler's rewrite
looks fine to me. If anything, we need a generic integer overflow check placed
around integer math.
Same goes for `arr.length -= -1': Again, this is how the language works. Mixing
signed and unsigned is allowed, as is `a - (-1)'. While I am positive on these
features in general as a nice-to-have, I think this bug report on array.length
is invalid and too narrow. Consider for example some custom struct exposing
some .length similar to arr.length, which would not be affected by a fix to
this bug. We would get different semantics where we are striving to unify the
experience.
--
More information about the Digitalmars-d-bugs
mailing list