Subject: Re: Making more LP64 friendly.
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 11/23/2003 19:35:48
In article <8AD6422A-1DDA-11D8-9362-000A957020BC@3am-software.com>,
Matt Thomas <matt@3am-software.com> wrote:
>I like to commit the following changes to <sys/tree.h>.  The primary
>changes is to add a bit of const poisoning and to make the comparision
>routine return long instead of int.  On a LP64 platform, the current
>use of int makes doing (note the additional const poisoning)
>int
>cmp(const struct type *a, const struct type *b)
>{
>   return b->f - a->f;
>}
>impossible if f is wider than an int.  That's an unneeded complication.

Traditionally comparison functions have the signature:

int cmp(const void *, const void *)

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.

christos