From: Harry Wei <jiaweiwei.xiyou@gmail.com>
To: rdunlap@xenotime.net, greg@kroah.com,
torvalds@linux-foundation.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org
Cc: linux-doc@vger.kernel.org
Subject: [PATCH]Add a condition for CodingStyle
Date: Sat, 19 Feb 2011 23:43:45 +0800 [thread overview]
Message-ID: <20110219154344.GA3474@gmail.com> (raw)
Hi us,
When i see Documentation/CodingStyle, i find a missing case for "Chapter 3: Placing Braces and Spaces". We often know we should not use braces where a single statement. The first case is:
if (condition)
action();
Another case is:
if (condition)
do_this();
else
do_that();
However, i can not find the second case. So i patch like following.
Thanks.
Best Regards.
Harry Wei.
Signed-off-by: Harry Wei <harryxiyou@gmail.com>
---
Documentation/CodingStyle | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 8bb3723..37eac37 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -168,6 +168,13 @@ Do not unnecessarily use braces where a single statement will do.
if (condition)
action();
+and
+
+if (condition)
+ do_this();
+else
+ do_that();
+
This does not apply if one branch of a conditional statement is a single
statement. Use braces in both branches.
--
1.7.0.4
reply other threads:[~2011-02-19 15:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20110219154344.GA3474@gmail.com \
--to=jiaweiwei.xiyou@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=greg@kroah.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=torvalds@linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.