summaryrefslogtreecommitdiffstats
path: root/Documentation/CodingStyle
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2007-05-08 09:30:34 +0200
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 20:15:12 +0200
commite659ba4a0d2d471c0d73590f78e1a1b5a1eede48 (patch)
tree136df203defc2924d2c29aef9330f4a5650bfb2a /Documentation/CodingStyle
parentext3: copy i_flags to inode flags on write (diff)
downloadlinux-e659ba4a0d2d471c0d73590f78e1a1b5a1eede48.tar.xz
linux-e659ba4a0d2d471c0d73590f78e1a1b5a1eede48.zip
CodingStyle: start flamewar about use of braces
Signed-off-by: Oliver Neukum <oneukum@suse.de> Cc: Tilman Schmidt <tilman@imap.cc> 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/CodingStyle15
1 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 9069189e78ef..e7f5fc6ef20b 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -160,6 +160,21 @@ supply of new-lines on your screen is not a renewable resource (think
25-line terminal screens here), you have more empty lines to put
comments on.
+Do not unnecessarily use braces where a single statement will do.
+
+if (condition)
+ action();
+
+This does not apply if one branch of a conditional statement is a single
+statement. Use braces in both branches.
+
+if (condition) {
+ do_this();
+ do_that();
+} else {
+ otherwise();
+}
+
3.1: Spaces
Linux kernel style for use of spaces depends (mostly) on