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

Matthias Bentrup via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 19 13:38:50 PST 2014


On Wednesday, 19 November 2014 at 20:40:53 UTC, bearophile wrote:
> Andrei Alexandrescu:
>
>> There are related bugs in Java too, e.g. I remember one in 
>> binary search where (i + j) / 2 was wrong because of an 
>> overflow.
>
> This is possible in D too.
>
>
>> Also, Java does have a package for unsigned integers so 
>> apparently it's necessary.
>
> This is irrelevant. No one here is saying that a system 
> language should not have unsigned values. The discussion here 
> is about the type of array lengths.
>
> Bye,
> bearophile

The only signed types that are able to represent all possible
array lengths on 64 bit systems are long double and cent.


More information about the Digitalmars-d mailing list