range.size() should be long, right?

Alex Rønne Petersen alex at lycus.org
Mon Jun 25 17:31:00 PDT 2012


On 25-06-2012 20:28, Mehrdad wrote:
> On Monday, 25 June 2012 at 18:22:00 UTC, Artur Skawina wrote:
>> What makes you think 'length' should evaluate to a size_t? If it it's
>> documented like that somewhere then that should be fixed.
>
> That is a VERY good question...
>
> I guess it doesn't /have/ to... didn't quite realize this.
>
> But the fact that it currently does for pretty much everything (even
> including std.bitmanip.BitArray.length) was what made me think this.
>
> I guess that should be fixed then..
>
>
>> It should be unsigned though, so if you need a type wider than 32-bit
>> size_t, use ulong etc.
>>
>> artur
>
> I mentioned signed in case we want to allow negatives just in case we
> want special values (e.g. "unknown length", etc.)

IMHO unsigned is fine. I personally strongly dislike the .NET situation 
where the convention is to use signed ints for everything due to some 
stupid language interoperability guideline just for VB.NET (and J# 
previously).

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org




More information about the Digitalmars-d mailing list