Skip to content

Commit

Permalink
Documentation: update CodingStyle use of braces
Browse files Browse the repository at this point in the history
After commit 38829dc ("Documentation/CodingStyle: flesh out if-else
examples") highlight that if _only_one_ branch of a conditional
statement is a single statement, then braces are to be used on both
branches.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Antonio Ospite authored and Linus Torvalds committed Nov 4, 2011
1 parent d83fe6b commit b218ab0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Documentation/CodingStyle
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ if (condition)
else
do_that();

This does not apply if one branch of a conditional statement is a single
statement. Use braces in both branches.
This does not apply if only one branch of a conditional statement is a single
statement; in the latter case use braces in both branches:

if (condition) {
do_this();
Expand Down

0 comments on commit b218ab0

Please sign in to comment.