Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jan 2002 15:38:37 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Mike Silbersack <silby@silby.com>
Cc:        <cvs-committers@FreeBSD.org>, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/kern uipc_socket2.c
Message-ID:  <20020108153239.K3495-100000@gamplex.bde.org>
In-Reply-To: <20020107194722.G31122-100000@patrocles.silby.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020108153239.K3495-100000>