From owner-cvs-all Mon Nov 25 22:18:48 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 0801537B401; Mon, 25 Nov 2002 22:18:47 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 14F4343E88; Mon, 25 Nov 2002 22:18:46 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.3/8.12.3) with ESMTP id gAQ6Iepk046294; Mon, 25 Nov 2002 23:18:42 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 25 Nov 2002 23:16:23 -0700 (MST) Message-Id: <20021125.231623.131888344.imp@bsdimp.com> To: grog@FreeBSD.org Cc: 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 From: "M. Warner Losh" In-Reply-To: <20021126002007.GZ41068@wantadilla.lemis.com> References: <200211242141.gAOLfgKf007413@repoman.freebsd.org> <20021125165825.R55700-100000@gamplex.bde.org> <20021126002007.GZ41068@wantadilla.lemis.com> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 In message: <20021126002007.GZ41068@wantadilla.lemis.com> "Greg 'groggy' Lehey" writes: : On Monday, 25 November 2002 at 17:00:03 +1100, Bruce Evans wrote: : > On Sun, 24 Nov 2002, Julian Elischer wrote: : > : >> julian 2002/11/24 13:41:42 PST : >> : >> Modified files: : >> sbin/fsck_ffs pass5.c : >> Log: : >> Fsck needs to check each CG's rotor values to ensure thay are not -ve. : >> It seems a common corruption to have them -ve (I've seen it several times) : >> and if fsck doesn't fix it, it leads to a kernel pagefault. : >> : >> Reviewd by: kirk : >> Submitted by: Eric Jacobs and me independently. : >> MFC in: 2 days : > : > Please fix the style bugs (excessive parentheses) in this before merging. : : I thought there was consensus that additional parentheses were not : necessarily a Bad Thing if they served to demonstrate operator : precedence, as here. Not when it is this simple: + if ((cg->cg_rotor >= 0) && (cg->cg_rotor < newcg->cg_ndblk)) 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 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. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message