lkml.org 
[lkml]   [2001]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [IDEA+RFC] Possible solution for min()/max() war
From
Date
Brad Chapman <kakadu_croc@yahoo.com> writes:

|> Everyone,
|>
|> From reading this thread, I believe I have come up with several reasons,
|> IMHO, why the old min()/max() macros were not usable:
|>
|> - They did not take into account non-typesafe comparisons
|> - They were too generic
|> - Some versions, IIRC, relied on typeof()
|> - They did not take into account signed/unsigned conversions
|>
|> I have also discovered one problem with the new three-arg min()/max()
|> macro: it forces both arguments to be the same, thus preventing signed/unsigned
|> comparisons.

There is no such thing as signed/unsigned comparision in C. Any
comparison is either signed or unsigned, depending on whether the common
type of arguments after applying the usual arithmetic conversions is
signed or unsigned.

|> Thus, I have a humble idea: add another type argument!

This does not bye you anything because the there can only be one common
type anyway.

Andreas.

--
Andreas Schwab "And now for something
SuSE Labs completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
-
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/

\
 
 \ /
  Last update: 2005-03-22 12:58    [W:0.093 / U:2.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site