Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jan 2001 10:28:01 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        =?ISO-8859-1?Q?G=E9rard_Roudier?= <groudier@club-internet.fr>
Cc:        John Baldwin <jhb@FreeBSD.org>, Jake Burkholder <jake@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/alpha/alpha interrupt.c machdep.c mp_mac
Message-ID:  <Pine.BSF.4.21.0101121014410.2022-100000@besplex.bde.org>
In-Reply-To: <Pine.LNX.4.10.10101111908440.1606-100000@linux.local>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 11 Jan 2001, [ISO-8859-1] G=E9rard Roudier wrote:

> Using too much upper-case names or kind of JUMBO-naming in C code does no=
t
> make the code more readable for the long run. It seems to me that all tha=
t
> useless GROSS naming has been the result of having exacerbated the focus
> of the day.

I agree, of course.

> Uppercase should be reserved mostly for stuff that is supposed
> to be completely evaluated by compilation phases as:
>=20
> - Constants (#define)
> - Enumeration tags
> - Macros accepting constant arguments.

Not sure about enums.

> As a result, usual stuff as MIN(), MAX(), offsetof() are misnamed in my
> opinion and should be of the opposite case.

MIN() and MAX() are in upper case because this is conventional for unsafe
macros (ones which evaluate their args more than once each).

MIN() and MAX() don't exist in the kernel (except as style bugs in some
code that rolls it own versions).  The imin() and imax(), etc., interfaces
are supposed to be used instead, although they are harder to use since they
are not type-generic.

PCPU_GET() is more like offsetof() and the SYSCTL() macros than MIN().
Its arg is an identifier, not a variable.  Therefore, upper case for it
is correct.  It is just unnecessary to expose this uglyness in the
interface.

> > However, there is a growing problem here that I want to state so that e=
veryone
> > doesn't jump up and down every time we add a clock cycle somewhere:
> >=20
> > Let's get it _right_ first, and optimize later.
>=20
> I didn't disagree with this statement.

Neither do I.  The interface was already _right_.  It happened to be
optimized in some cases.  Now it is wrong and happens to be unoptimized.

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?Pine.BSF.4.21.0101121014410.2022-100000>