diff options
author | Oliver Neukum <oliver@neukum.org> | 2007-05-08 03:30:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:12 -0400 |
commit | e659ba4a0d2d471c0d73590f78e1a1b5a1eede48 (patch) | |
tree | 136df203defc2924d2c29aef9330f4a5650bfb2a /Documentation | |
parent | 28be5abb400e5e082f5225105fdc69337ec0c0b4 (diff) |
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')
-rw-r--r-- | Documentation/CodingStyle | 15 |
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 | |||
160 | 25-line terminal screens here), you have more empty lines to put | 160 | 25-line terminal screens here), you have more empty lines to put |
161 | comments on. | 161 | comments on. |
162 | 162 | ||
163 | Do not unnecessarily use braces where a single statement will do. | ||
164 | |||
165 | if (condition) | ||
166 | action(); | ||
167 | |||
168 | This does not apply if one branch of a conditional statement is a single | ||
169 | statement. Use braces in both branches. | ||
170 | |||
171 | if (condition) { | ||
172 | do_this(); | ||
173 | do_that(); | ||
174 | } else { | ||
175 | otherwise(); | ||
176 | } | ||
177 | |||
163 | 3.1: Spaces | 178 | 3.1: Spaces |
164 | 179 | ||
165 | Linux kernel style for use of spaces depends (mostly) on | 180 | Linux kernel style for use of spaces depends (mostly) on |