Re: small patch for pty.c

From: Linus Torvalds (torvalds@transmeta.com)
Date: Mon Apr 17 2000 - 22:26:05 EST


On Mon, 17 Apr 2000, Horst von Brand wrote:
>
> Up to the next cleanup, when somebody wonders why your'e not using MIN as
> a few lines before and changes it back.
>
> Better fix MIN to work right, and get rid of _all_ these problems for good.

No. Wrong moral. You should not "fix" MIN().

MIN() is a _bad_ thing to use. It _always_ gets the sign wrong. Sorry, but
that's how it is. It makes people think that "oh, it takes the minimum of
two numbers" and at the same time it makes people completely forget
signedness issues.

In short, it's a really stupid macro, for something that is usually
simpler to do by hand anyway. And doing it by hand you can make it work
right, without confusion like this.

MIN() should go. If people really want to use a macro for something as
simple as MIN(), then you should always use UMIN() and SMIN(), and make
people have to think about signedness issues (but even then you tend to be
better off just doing it explicitly by hand).

                Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:12 EST