Skip to content

Commit

Permalink
Documentation/CodingStyle: Add an example for braces
Browse files Browse the repository at this point in the history
Add another example of required braces when using a compound statement in
a loop.

Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
  • Loading branch information
garyrhook authored and Jonathan Corbet committed Mar 21, 2018
1 parent 5a5d1a7 commit 1dbba2c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Documentation/process/coding-style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,15 @@ statement; in the latter case use braces in both branches:
otherwise();
}
Also, use braces when a loop contains more than a single simple statement:

.. code-block:: c
while (condition) {
if (test)
do_something();
}
3.1) Spaces
***********

Expand Down

0 comments on commit 1dbba2c

Please sign in to comment.