From owner-cvs-all Mon Jan 7 20:38:21 2002 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id D73AB37B47A; Mon, 7 Jan 2002 20:38:01 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id PAA08757; Tue, 8 Jan 2002 15:37:57 +1100 Date: Tue, 8 Jan 2002 15:38:37 +1100 (EST) From: Bruce Evans X-X-Sender: To: Mike Silbersack Cc: , Subject: Re: cvs commit: src/sys/kern uipc_socket2.c In-Reply-To: <20020107194722.G31122-100000@patrocles.silby.com> Message-ID: <20020108153239.K3495-100000@gamplex.bde.org> 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 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message