Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2002 22:30:12 -0800 (PST)
From:      Julian Elischer <julian@elischer.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
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
Message-ID:  <Pine.BSF.4.21.0211252225370.46897-100000@InterJet.elischer.org>
In-Reply-To: <20021125.231623.131888344.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0211252225370.46897-100000>