From: "Satyam Sharma" <satyam.sharma@gmail.com>
To: "Jeff Garzik" <jeff@garzik.org>
Cc: "Randy Dunlap" <randy.dunlap@oracle.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: CodingStyle: start flamewar about use of braces
Date: Wed, 9 May 2007 05:07:24 +0530 [thread overview]
Message-ID: <a781481a0705081637x129cb009u6a557205d3776014@mail.gmail.com> (raw)
In-Reply-To: <4640E971.9050400@garzik.org>
On 5/9/07, Jeff Garzik <jeff@garzik.org> wrote:
> Randy Dunlap wrote:
> > On Tue, 8 May 2007 19:03:10 GMT Linux Kernel Mailing List wrote:
> >
> >> Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e659ba4a0d2d471c0d73590f78e1a1b5a1eede48
> >> Commit: e659ba4a0d2d471c0d73590f78e1a1b5a1eede48
> >> Parent: 28be5abb400e5e082f5225105fdc69337ec0c0b4
> >> Author: Oliver Neukum <oliver@neukum.org>
> >> AuthorDate: Tue May 8 00:30:34 2007 -0700
> >> Committer: Linus Torvalds <torvalds@woody.linux-foundation.org>
> >> CommitDate: Tue May 8 11:15:12 2007 -0700
> >>
> >> CodingStyle: start flamewar about use of braces
> >
> > It worked somewhat. We never did reach any kind of
> > concensus about this....
> >
> >
> >> Signed-off-by: Oliver Neukum <oneukum@suse.de>
> >> Cc: Tilman Schmidt <tilman@imap.cc>
> >> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> >> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> >> ---
> >> Documentation/CodingStyle | 15 +++++++++++++++
> >> 1 files changed, 15 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> >> index 9069189..e7f5fc6 100644
> >> --- a/Documentation/CodingStyle
> >> +++ b/Documentation/CodingStyle
> >> @@ -160,6 +160,21 @@ supply of new-lines on your screen is not a renewable resource (think
> >> 25-line terminal screens here), you have more empty lines to put
> >> comments on.
> >>
> >> +Do not unnecessarily use braces where a single statement will do.
> >> +
> >> +if (condition)
> >> + action();
> >> +
> >> +This does not apply if one branch of a conditional statement is a single
> >> +statement. Use braces in both branches.
> >> +
> >> +if (condition) {
> >> + do_this();
> >> + do_that();
> >> +} else {
> >> + otherwise();
> >> +}
>
> If anyone tries to add braces to my code's 'else' statements where they
> are not required, that patch will get NAK'd in a heartbeat.
Yes. This patch shouldn't go in. There's no ambiguity in
Documentation/CodingStyle that it fixes anyway, only *imposes* a
"style", which:
(1) there is no consensus about *at all*, and
(2) blatantly goes against _all_ similar examples in K&R.
It's quite funny to worship them as "prophets" and adopt their style
for some stuff (with a simple "Rationale: K&R.") one instant and then
suggest a style completely opposite to theirs one screenful later in
the same file.
next prev parent reply other threads:[~2007-05-08 23:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200705081903.l48J3AOw010373@hera.kernel.org>
2007-05-08 19:43 ` Randy Dunlap
2007-05-08 21:19 ` Jeff Garzik
2007-05-08 22:25 ` Lennart Sorensen
2007-05-08 22:50 ` Stephen Clark
2007-05-08 23:01 ` Jeff Garzik
2007-05-08 23:37 ` Satyam Sharma [this message]
2007-05-09 8:16 ` Stefan Richter
2007-05-09 8:59 ` Pekka Enberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a781481a0705081637x129cb009u6a557205d3776014@mail.gmail.com \
--to=satyam.sharma@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®