From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Fri, 24 Aug 2001 19:59:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Fri, 24 Aug 2001 19:59:17 -0400 Received: from web10902.mail.yahoo.com ([216.136.131.38]:49414 "HELO web10902.mail.yahoo.com") by vger.kernel.org with SMTP id ; Fri, 24 Aug 2001 19:59:11 -0400 Message-ID: <20010824235927.65425.qmail@web10902.mail.yahoo.com> Date: Fri, 24 Aug 2001 16:59:27 -0700 (PDT) From: Brad Chapman Subject: Re: [IDEA+RFC] Possible solution for min()/max() war To: Ben LaHaise Cc: linux-kernel@vger.kernel.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --- Ben LaHaise wrote: > On Fri, 24 Aug 2001, Brad Chapman wrote: > > > This way, some hackers can use the two-arg min()/max() inside an #ifdef block, > > other hackers can use the three-arg min()/max() inside an #ifdef block, > > and people who don't care can select either. > > Have you no taste? Use of #ifdef's should be minimised as much as > possible. For this kind of construct, the spurious preprocessor usage > just makes me want to vomit. > > -ben Mr. LaHaise, Eeek! Sorry. That was just a preliminary. As I see it, there are several ways to wire this up: - make everyone use the new macros (some people are thinking :P) - make everyone use #ifdef blocks with a config option (you think it's :P) - make min()/max() typeof() wrappers for a switch-style stack of comparison functions which work on the various types, i.e: __u8 minimum = min(one, two) -> __u8 minimum = __u8_min(one, two) (this may be too complex and is probably :P) - make min()/max() inline functions, cast things to void, and use memcmp() (this sounds reasonable, but is probably also :P) - stay with the old-style macros (:P, :P, :P) What do you think, sir? Brad ===== Brad Chapman Permanent e-mail: kakadu_croc@yahoo.com Current e-mail: kakadu@adelphia.net Alternate e-mail: kakadu@netscape.net __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/