From owner-cvs-all Thu Jan 11 15:26:51 2001 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 05DFC37B404; Thu, 11 Jan 2001 15:26:18 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id KAA01727; Fri, 12 Jan 2001 10:26:10 +1100 Date: Fri, 12 Jan 2001 10:28:01 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: =?ISO-8859-1?Q?G=E9rard_Roudier?= Cc: John Baldwin , Jake Burkholder , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/alpha/alpha interrupt.c machdep.c mp_mac In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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