Re: Lindent fixed to match reality

From: David Weinehall
Date: Fri Jan 30 2004 - 12:51:30 EST


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@xxxxxxxxxx> /) Northern lights wander (\
// Maintainer of the v2.0 kernel // Dance across the winter sky //
\) http://www.acc.umu.se/~tao/ (/ Full colour fire (/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/