From owner-cvs-all Mon Jan 7 20:41:52 2002 Delivered-To: cvs-all@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 5E89037B41D; Mon, 7 Jan 2002 20:41:43 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id PAA02989; Tue, 8 Jan 2002 15:41:40 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37640) with ESMTP id <01KCU0UDCDCGVLSGP8@cim.alcatel.com.au>; Tue, 8 Jan 2002 15:41:38 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.6/8.11.6) id g084fZV60257; Tue, 08 Jan 2002 15:41:35 +1100 Content-return: prohibited Date: Tue, 08 Jan 2002 15:41:34 +1100 From: Peter Jeremy Subject: Re: cvs commit: src/sys/kern uipc_socket2.c In-reply-to: <20020107194722.G31122-100000@patrocles.silby.com>; from silby@silby.com on Mon, Jan 07, 2002 at 07:58:52PM +0000 To: Mike Silbersack Cc: Bruce Evans , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Mail-Followup-To: Mike Silbersack , Bruce Evans , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Message-id: <20020108154134.E561@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <20020107160807.V376-100000@gamplex.bde.org> <20020107194722.G31122-100000@patrocles.silby.com> 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 2002-Jan-07 19:58:52 +0000, 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? I don't have a copy of the ISO standards, but K&R2 states: A7.9 Relational operators ... The usual arithmetic conversions are performed on arithmetic operands. ... "Usual arithmetic conversions" are defined in A6.5 and have the intent that the values of both operands will be preserved by the conversion. There are a few gotchas: - comparing int/long to float may lose precision - if long is 64-bits, comparing long to double may lose precision - comparing signed to unsigned values with the same size may produce unexpected results when then signed operand is negative. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message