[Issue 21151] div bug: long -5000 / size_t 2 = 9223372036854773308

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 13 07:48:08 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21151

FeepingCreature <default_357-line at yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |default_357-line at yahoo.de

--- Comment #4 from FeepingCreature <default_357-line at yahoo.de> ---
I'm completely on mw's side here, even understanding why D does this. Silently
casting negative signed to unsigned violates the foundational principle that at
least on built-in types, implicit conversions should never throw away data.

Though I think it should be a spec enhancement issue, to correct 6.8.1.4.4:
"The signed type is converted to the unsigned type."
https://dlang.org/spec/type.html#usual-arithmetic-conversions

--


More information about the Digitalmars-d-bugs mailing list