Documentation/CodingStyle: Add an example for braces

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>
This commit is contained in:
Gary R Hook 2018-03-14 17:21:38 -05:00 committed by Jonathan Corbet
parent 5a5d1a7708
commit 1dbba2cf30
1 changed files with 9 additions and 0 deletions

View File

@ -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
***********