Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Nov 2002 17:59:16 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        "Greg 'groggy' Lehey" <grog@FreeBSD.org>
Cc:        Julian Elischer <julian@FreeBSD.org>, <cvs-committers@FreeBSD.org>, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/sbin/fsck_ffs pass5.c
Message-ID:  <20021126173629.E3086-100000@gamplex.bde.org>
In-Reply-To: <20021126002007.GZ41068@wantadilla.lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 26 Nov 2002, Greg 'groggy' Lehey wrote:

> 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
> >> ...
> > 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.

Here is a patch to fix these style bugs.

%%%
Index: pass5.c
===================================================================
RCS file: /home/ncvs/src/sbin/fsck_ffs/pass5.c,v
retrieving revision 1.34
diff -u -0 -r1.34 pass5.c
--- pass5.c	24 Nov 2002 23:54:29 -0000	1.34
+++ pass5.c	25 Nov 2002 05:12:02 -0000
@@ -187 +188 @@
-		if ((cg->cg_rotor >= 0) && (cg->cg_rotor < newcg->cg_ndblk))
+		if (cg->cg_rotor >= 0 && cg->cg_rotor < newcg->cg_ndblk)
@@ -191 +192 @@
-		if ((cg->cg_frotor >= 0) && (cg->cg_frotor < newcg->cg_ndblk))
+		if (cg->cg_frotor >= 0 && cg->cg_frotor < newcg->cg_ndblk)
@@ -195 +196 @@
-		if ((cg->cg_irotor >= 0) && (cg->cg_irotor < fs->fs_ipg))
+		if (cg->cg_irotor >= 0 && cg->cg_irotor < fs->fs_ipg)
%%%

To me, parenthesizing almost eveything demonstrates that the author is not
fluent in C.  Parentheses are a necessary evil in some contexts, but the
above is not such a context.

The style of parenthesizing almost everything doesn't seem to be used
anywhere else in fsck_ffs/*.c.  It is used in 0 of 3 other lines matching
the regexp ">=.*&&" and in 0 of 40 lines matching "==.*&&".

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?20021126173629.E3086-100000>