Re: Lindent fixed to match reality

David Weinehall
2004-01-30T17:49:29Z

On Fri, Jan 30, 2004 at 09:44:42AM -0500, Theodore Ts'o wrote:
> On Fri, Jan 30, 2004 at 12:43:36AM +0100, David Weinehall wrote:
> > "Everyone" also sprinkles far too many parenthesis for their own code,
> > just to be sure. I've seen code such as
> >
> > a = b * c + 1;
> >
> > written as
> >
> > a = ((b * c) + 1);
> >
> > The question is rather, why should you insert superfluous parenthesis
> > when they do no semantic difference, and do not improve readability in
> > any way?
>
> I disagree; sometimes adding a few extra parenthesis *does* improve
> readability, especially if the expression is complex. Of course, if
> it's that complex, you might be better off defining a few extra
> variables and having named sub-expressions (it shouldn't make a
> difference to a good compiler).

Possibly "when they do" should've been "if they do" to clarify what I
meant. I don't mean that dropping all superfluous parantheses are
necessarily good, but most of the time, people tend to sprinkle the code
with them just because they lack in their knowledge of basic
C-programming. I'm not saying this is the case for the kernel, just
that I've seen it far too often.

I agree about the sub-expression bit though.

Regards: David Weinehall
--
/) David Weinehall <tao@acc.umu.se> /) Northern lights wander (\
// Maintainer of the v2.0 kernel // Dance across the winter sky //
\) http://www.acc.umu.se/~tao/ (/ Full colour fire (/