Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jan 2002 12:44:30 +0000 (GMT)
From:      Mike Silbersack <silby@silby.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        cvs-committers@FreeBSD.org, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/kern uipc_socket2.c
Message-ID:  <20020109124252.F2484-100000@patrocles.silby.com>
In-Reply-To: <20020108153239.K3495-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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




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