[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20110219154344.GA3474@gmail.com>
Date: Sat, 19 Feb 2011 23:43:45 +0800
From: Harry Wei <jiaweiwei.xiyou@...il.com>
To: rdunlap@...otime.net, greg@...ah.com,
torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org
Cc: linux-doc@...r.kernel.org
Subject: [PATCH]Add a condition for CodingStyle
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@...il.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
--
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