Andrei's std.path review

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Sat Aug 13 05:20:03 PDT 2011


On Thu, 11 Aug 2011 00:27:54 -0700, Jonathan M Davis wrote:
> On Thursday, August 11, 2011 07:10:08 Lars T. Kyllingstad wrote:
>> On Wed, 10 Aug 2011 12:37:01 -0600, Andrei Alexandrescu wrote:
>> > * filenameCharCmp and filenameCmp -> why long and not int?
>> 
>> filenameCharCmp() returns a-b, and since a and b are dchars, the
>> corresponding signed type is long.  filenameCmp() returns long because
>> filenameCharCmp() does.
> 
> I'd argue that you should just cast it to int and return int. All the
> various compare functions promise is whether the return value is less
> than, equal to, or greater than 0. Relying on the exact value is wrong.
> And normally such functions return int. So, I don't see any reason why
> these shouldn't be change to return int.

But what do we gain by making it an int?  long just seems more natural in 
this case, IMO.

-Lars


More information about the Digitalmars-d mailing list