aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary R Hook <gary.hook@amd.com>2018-03-14 18:21:38 -0400
committerJonathan Corbet <corbet@lwn.net>2018-03-21 11:17:09 -0400
commit1dbba2cf30c9be65287d2c83ad35db72c62890ad (patch)
treedb1e2bf73933dce05797113b68d8fd6240ed5d41
parent5a5d1a77085f9d11c0a946d164330af4d5412a66 (diff)
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>
-rw-r--r--Documentation/process/coding-style.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index a20b44a40ec4..d98deb62c400 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -200,6 +200,15 @@ statement; in the latter case use braces in both branches:
200 otherwise(); 200 otherwise();
201 } 201 }
202 202
203Also, use braces when a loop contains more than a single simple statement:
204
205.. code-block:: c
206
207 while (condition) {
208 if (test)
209 do_something();
210 }
211
2033.1) Spaces 2123.1) Spaces
204*********** 213***********
205 214