From owner-cvs-all Wed Jan 9 10:41:56 2002 Delivered-To: cvs-all@freebsd.org Received: from patrocles.silby.com (d170.as10.nwbl0.wi.voyager.net [169.207.133.44]) by hub.freebsd.org (Postfix) with ESMTP id A72CF37B41D; Wed, 9 Jan 2002 10:41:50 -0800 (PST) Received: from localhost (silby@localhost) by patrocles.silby.com (8.11.6/8.11.6) with ESMTP id g09CiUN02975; Wed, 9 Jan 2002 12:44:35 GMT (envelope-from silby@silby.com) X-Authentication-Warning: patrocles.silby.com: silby owned process doing -bs Date: Wed, 9 Jan 2002 12:44:30 +0000 (GMT) From: Mike Silbersack To: Bruce Evans Cc: cvs-committers@FreeBSD.org, Subject: Re: cvs commit: src/sys/kern uipc_socket2.c In-Reply-To: <20020108153239.K3495-100000@gamplex.bde.org> Message-ID: <20020109124252.F2484-100000@patrocles.silby.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 8 Jan 2002, Bruce Evans wrote: > On Mon, 7 Jan 2002, Mike Silbersack wrote: > > > If we use the simple macro > > #define min(a,b) (((a)<(b))?(a):(b)) > > and a & b's types differ, does the compiler promote the lesser size to the > > greater size for the purpose of the comparison, or does the comparison > > occur only on the size of the lesser argument? > > The compiler always promotes types (not sizes) in binary expressions. > This works right for comparison except when the operand types have the > same size but differ in signedness. The problem with the min() and > MIN() macros is that they evaluate their args more than once. > > Bruce Ah, I can see the potential problems with signedness. As for the evaluation of arguments; wouldn't the inline min functions in libkern.h do the same? Mike "Silby" Silbersack To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message