January 24, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=8666



--- Comment #3 from Don <clugdbug@yahoo.com.au> 2014-01-24 01:50:36 PST ---
This is just a consequence of the fact that overflow checking never happens for integral types.

int x = abs(int.min);

returns an incorrect result, in the same way that

int y = int.max + int.max;

returns an incorrect result. There's really nothing special going on here, all of the types are correct. It's not unsigned, there is no doubt about how to interpret the number -- it's positive. It just doesn't fit!

If we declare that integer overflow is an error, as has been proposed a few times, we could use bound checking to statically detect some of these cases.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 24, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=8666


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |WONTFIX


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2014-01-24 11:32:32 PST ---
There's really nothing to be done about this. Adding runtime checks would seriously degrade performance.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------