Skip to contentSkip to conversation

Add a condition for CodingStyle

PATCH New Harry Wei 1 participant 1 message Feb 19, 2011 Documentation

lore
Share & tools
lore

Harry Wei

author
#0 lore raw

PATCH 1/1 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.
---
 Documentation/CodingStyle |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Documentation/CodingStyle +7 -0
index 8bb3723..37eac37 100644
@@ -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.
 
Signature · 1 line
1.7.0.4