From owner-freebsd-current Wed Jan 27 18:43:33 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA22680 for freebsd-current-outgoing; Wed, 27 Jan 1999 18:43:33 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from janus.syracuse.net (janus.syracuse.net [205.232.47.15]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA22668 for ; Wed, 27 Jan 1999 18:43:25 -0800 (PST) (envelope-from green@unixhelp.org) Received: from localhost (green@localhost) by janus.syracuse.net (8.8.8/8.8.7) with ESMTP id VAA11735; Wed, 27 Jan 1999 21:43:22 -0500 (EST) Date: Wed, 27 Jan 1999 21:43:21 -0500 (EST) From: Brian Feldman X-Sender: green@janus.syracuse.net To: Peter Jeremy cc: current@FreeBSD.ORG Subject: Re: btokup() macro in sys/malloc.h In-Reply-To: <99Jan28.131753est.40347@border.alcanet.com.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 28 Jan 1999, Peter Jeremy wrote: > Matthew Dillon wrote: > >:> NEW > >:> > >:> #define btokup(addr) (&kmemusage[((caddr_t)(addr) - kmembase) >> PAGE_SHIFT]) > >: > >:The added parentheses don't make any difference, semantically. This > >:change probably wouldn't meet the criteria spelled out in style(9): > > > > Then style(9) needs to be updated, because we have to add parenthesis > > to be able to not get warnings with -Wall. > > I'll support that. The example given in style(9): > > a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1; > > should rate as an entry in the Obfuscated C competition rather than > an example of maintainable code. > > style(9) should emphasize legibility and maintainability, rather than > minimizing the number of extraneous (from the compiler's perspective) > parenthesis. The code you're writing has to be maintained for many years > - and the maintainers will not always have your in-depth expertise. > The code also forms a `reference implementation' for someone who wants > to do something similar. Here's another vote from someone who uses liberal parentheses! I think of it like this: it may be correct, but if I can't understand it after I've written it, what good is the code? Saving a few bytes isn't worth obfuscating code. Style(9) should /dons flame-retardant suit/ encourage usage of extra parens that make code more readable to humans. > > Peter > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > Brian Feldman _ __ ___ ___ ___ green@unixhelp.org _ __ ___ | _ ) __| \ http://www.freebsd.org/ _ __ ___ ____ | _ \__ \ |) | FreeBSD: The Power to Serve! _ __ ___ ____ _____ |___/___/___/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message