Subject: Re: Making more LP64 friendly.
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 11/24/2003 02:36:09
In article <6.0.0.22.2.20031123151504.03052328@3am-software.com>,
Matt Thomas <matt@3am-software.com> wrote:
>At 11:35 AM 11/23/2003, Christos Zoulas wrote:
>>
>>Traditionally comparison functions have the signature:
>>
>>int cmp(const void *, const void *)
>
>Except that most of these were defined when everything was ILP32 and so
>the return type didn't matter.

Actually this is not the reason. The return type is an integer because
it only matters if it is less than, equal, or greater than zero. I.e. it
never matters how big it is, so nobody cares if it holds the result of
the subtraction that is implementation dependent anyway, and breaks in
case of overflow.
	
>>I guess here the user does not specify the comparison function, so you
>>are right that we don't need the extra complication to convert the result
>>from a long to an int.
>
>So are agreeing with me or disagreeing? :)

I agree that it should be fixed so that it works with 64 bit keys.
I don't particularly care if the result of the comparison is a long or
an int (although for consistency it might as well remain an integer).

christos