Re: [IDEA+RFC] Possible solution for min()/max() war

David Weinehall (tao@acc.umu.se)
Thu, 30 Aug 2001 23:47:00 +0200


On Thu, Aug 30, 2001 at 09:16:47PM +0000, Graham Murray wrote:
> Daniel Phillips <phillips@bonn-fries.net> writes:
>
> > More than anything, it shows that education is needed, not macro patch-ups.
> > We have exactly the same issues with < and >, should we introduce
> > three-argument macros to replace them?
>
> Would it not have been much more "obvious" if the rules for
> unsigned/signed integer comparisons (irrespective of the widths
> involved) were
>
> 1) If the signed element is negative then it is always less than the
> unsigned element.
>
> 2) If the unsigned element is greater than then maximum positive value
> expressible by the signed one then it is always greater.
>
> 3) Only if both values are positive and within the range of the
> smaller element are the actual values compared.

Possibly, but changing the C specification is not really an option here...

/David Weinehall
_ _
// David Weinehall <tao@acc.umu.se> /> Northern lights wander \\
// Project MCA Linux hacker // Dance across the winter sky //
\> http://www.acc.umu.se/~tao/ </ Full colour fire </
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/