[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200704061505.41956.david-b@pacbell.net>
Date: Fri, 6 Apr 2007 15:05:41 -0700
From: David Brownell <david-b@...bell.net>
To: Roland Dreier <rdreier@...co.com>
Cc: Stefan Richter <stefanr@...6.in-berlin.de>,
Jan Engelhardt <jengelh@...ux01.gwdg.de>,
Randy Dunlap <randy.dunlap@...cle.com>,
Tony Lindgren <tony@...mide.com>, linux-kernel@...r.kernel.org
Subject: Re: coding style for long conditions
On Friday 06 April 2007 2:38 pm, Roland Dreier wrote:
> [I can't believe I'm stepping into an indentation flamewar, but here goes...]
At least you weren't the target of attacks there ... for daring to
actually follow the only published Linux style guide in that area!!
> > Please change your coding style to conform to Documentation/CodingStyle.
> >
> > *** Only indent with tabs!! ***
Having a style guide is supposed to mean, among other things, that
following it gives you "safe harbor". Sigh.
> If you have a git tree handy, you can do "git show 68380b58" and see
> that Linus himself wrote:
>
> if (get_wq_data(work) == cwq
> && work_pending(work)
> && !list_empty(&work->entry)) {
Yeah, well even the chief penguin wrangler has occasionally
admitted to human imperfections. Not exclusively related to
the 0.99 kernel series, either ... ;)
> I have to admit that I would have put the &&s at the ends of the
> previous lines rather than where Linus put them,
I approve in particular of that location: beginning of line, where
they aren't masking the intent of the condition from a casual scan.
If there's a "right" place, that's it.
In particular, if you see lots of "&&" or "||" neatly lined up it
helps you understand something about when the conditional's body
will execute without needing to read to the end of every line.
> but... egads! Linus
> put spaces before the &&s to line them up nicely!
>
> "more in the breach" and all that I guess...
Yeah, nobody likes style nazis. On the other hand, it's rather
unusual to be the target of style nazism for actually following
the style guide!! You'd think that maybe the folk objecting to
that style guide might maybe choose a more direct way to address
their particular frustrations, eh? :)
- Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists