diff options
author | Harry Wei <jiaweiwei.xiyou@gmail.com> | 2011-03-22 19:35:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:16 -0400 |
commit | 38829dc9d7b46b195ab99d62c8c53c21a7adc36b (patch) | |
tree | ff38cc7aa7965af81e2d5ee5f21e2724489269ec /Documentation/CodingStyle | |
parent | 0bc825d240abcaf5ed6e9d59b44215b51718ef5b (diff) |
Documentation/CodingStyle: flesh out if-else examples
There is 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 a description of the second case.
Signed-off-by: Harry Wei <harryxiyou@gmail.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/CodingStyle')
-rw-r--r-- | Documentation/CodingStyle | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index 1cd3478e5834..58b0bf917834 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle | |||
@@ -168,6 +168,13 @@ Do not unnecessarily use braces where a single statement will do. | |||
168 | if (condition) | 168 | if (condition) |
169 | action(); | 169 | action(); |
170 | 170 | ||
171 | and | ||
172 | |||
173 | if (condition) | ||
174 | do_this(); | ||
175 | else | ||
176 | do_that(); | ||
177 | |||
171 | This does not apply if one branch of a conditional statement is a single | 178 | This does not apply if one branch of a conditional statement is a single |
172 | statement. Use braces in both branches. | 179 | statement. Use braces in both branches. |
173 | 180 | ||