Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jul 2004 14:00:14 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        David Schultz <das@freebsd.org>
Cc:        cvs-src@freebsd.org
Subject:   Re: cvs commit: src/sys/vm vm_map.c
Message-ID:  <20040701135645.B3068@gamplex.bde.org>
In-Reply-To: <20040630030248.GA26810@VARK.homeunix.com>
References:  <200406281915.i5SJFeaV060231@repoman.freebsd.org> <20040628193858.GG5635@green.homeunix.org> <20040629114614.T2908@gamplex.bde.org> <20040630095111.U2619@gamplex.bde.org> <20040630030248.GA26810@VARK.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 29 Jun 2004, David Schultz wrote:

> On Wed, Jun 30, 2004, Bruce Evans wrote:
> > On Tue, 29 Jun 2004, Andrew Gallatin wrote:
> >
> > > Bruce Evans writes:
> > >  > MIN() and MAX() should not be used in the kernel.  4.4BSD removed them in
> > >  > the kernel, but FreeBSD broke this in rev.1.141 of sys/param.h.  They
> > >  > remain removed in RELENG_4.
> > >
> > > OK.  Then what's the correct fix? ulmin()?
> >
> > Fixing min() to handle all unsigned types is probably best.
>
> Hmm...but this means either
>
> a) slightly pessimizing 32-bit ports with a function on uintmax_t's,

This was in my list of slightly incorrect fixes.

> b) using a macro and introducing double-expansion problems, or

This was removed in 4.4BSD.

> c) using GCC extensions
>
> Option (c) seems best from a technical standpoint, except that
> we'd be making it harder than it already is to compile the kernel
> with compilers other than gcc and icc.  (Do others have the
> statement expr extension?)

I tried not to use gcc extensions for this back in FreeBSD-2, but
the kernel is now so full with gccisms that another one wouldn't
matter.  It needs __typeof() more than staement-expressions.

Bruce



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