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

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 19 02:33:09 PST 2014


On Tuesday, 18 November 2014 at 18:03:35 UTC, ketmar via 
Digitalmars-d wrote:
> On Tue, 18 Nov 2014 17:59:04 +0000
> David Eagen via Digitalmars-d <digitalmars-d at puremagic.com> 
> wrote:
>
>> Isn't the purpose of size_t is to be large enough to address 
>> all available memory? A negative value is not only too small 
>> but doesn't make sense when discussing lengths.
>> 
>> Correctness requires using size_t.
> yes. besides, there is no such thing as "negative length", so 
> it's
> somewhat... weird to use signed integer for length.

The reason is so that D won't mess with implicit signed-unsigned 
conversion, not negative length.


More information about the Digitalmars-d mailing list