'int' is enough for 'length' to migrate code from x86 to x64

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 25 05:52:31 PST 2014


On Tuesday, 25 November 2014 at 11:43:01 UTC, Don wrote:
> Why are defining behaviour that is always a bug? Java makes it 
> defined, but it has to because it doesn't have unsigned types.
> I think the intention probably was to improve on the C 
> situation, where there is undefined behaviour that really 
> should be defined.

Mostly to prevent optimizations based on no-overflow assumption.

> But do we really want to preclude ever having overflow checking 
> for integers?

Overflow checking doesn't contradict to overflow being defined. 
The latter simply reflects how hardware works, nothing else. And 
hardware works that way, because that's a fast implementation of 
arithmetic for general case.


More information about the Digitalmars-d mailing list