From 38829dc9d7b46b195ab99d62c8c53c21a7adc36b Mon Sep 17 00:00:00 2001 From: Harry Wei Date: Tue, 22 Mar 2011 16:35:01 -0700 Subject: [PATCH] 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 Cc: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/CodingStyle | 7 +++++++ 1 file changed, 7 insertions(+) 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. 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. -- 2.30.2