From: Oliver Neukum Date: Tue, 8 May 2007 07:30:34 +0000 (-0700) Subject: CodingStyle: start flamewar about use of braces X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=e659ba4a0d2d471c0d73590f78e1a1b5a1eede48;p=deliverable%2Flinux.git CodingStyle: start flamewar about use of braces Signed-off-by: Oliver Neukum Cc: Tilman Schmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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