From owner-cvs-all Mon Nov 25 22:31:25 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 562E237B401; Mon, 25 Nov 2002 22:31:24 -0800 (PST) Received: from rwcrmhc52.attbi.com (rwcrmhc52.attbi.com [216.148.227.88]) by mx1.FreeBSD.org (Postfix) with ESMTP id 007FB43EBE; Mon, 25 Nov 2002 22:31:24 -0800 (PST) (envelope-from julian@elischer.org) Received: from InterJet.elischer.org (12-232-168-4.client.attbi.com[12.232.168.4]) by rwcrmhc52.attbi.com (rwcrmhc52) with ESMTP id <20021126063122052002q7l5e>; Tue, 26 Nov 2002 06:31:23 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id WAA47562; Mon, 25 Nov 2002 22:30:14 -0800 (PST) Date: Mon, 25 Nov 2002 22:30:12 -0800 (PST) From: Julian Elischer To: "M. Warner Losh" Cc: grog@FreeBSD.org, bde@zeta.org.au, julian@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sbin/fsck_ffs pass5.c In-Reply-To: <20021125.231623.131888344.imp@bsdimp.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 25 Nov 2002, M. Warner Losh wrote: > Not when it is this simple: > > + if ((cg->cg_rotor >= 0) && (cg->cg_rotor < newcg->cg_ndblk)) It's a judgement call and I think that the parens make it more readable. > > Anybody that has half a 'C' clue know that those aren't needed. The > times they are needed is when they are more complex. That was also > part of the consensus. > > Eg, The above should be written like: > + if (cg->cg_rotor >= 0 && cg->cg_rotor < newcg->cg_ndblk) > which is clearer, but something like I don't think it is clearer. > > if (a == x && b == y || c == z) > > should be written as > > if (a == x && (b == y || c == z)) > > since that is clearer and likely what was intended. > > That was the consensus. When it is needed for clarity. Many people > that learned pascal originally keep the extra parens because they are > needed there. However, there's a huge body of code that writes the > above code in the second way I sighted, not the first. I disagree and I doubt that style(9) can force it one way or the other. I have seen 3 sources of this patch (done independently). (Including my own) All 3 had the parens. I think it makes it more readable. And you don't. julian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message