more LP64 friendly.
To: None <tech-kern@netbsd.org>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 11/23/2003 15:17:40
At 11:35 AM 11/23/2003, Christos Zoulas wrote:
>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 *)
Except that most of these were defined when everything was ILP32 and so
the return type didn't matter.
>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? :)
--
Matt Thomas email: matt@3am-software.com
3am Software Foundry www: http://3am-software.com/bio/matt/
Cupertino, CA disclaimer: I avow all knowledge of this message.