summaryrefslogtreecommitdiffstats
path: root/Documentation/process/coding-style.rst
diff options
context:
space:
mode:
authorGary R Hook2018-03-14 23:21:38 +0100
committerJonathan Corbet2018-03-21 16:17:09 +0100
commit1dbba2cf30c9be65287d2c83ad35db72c62890ad (patch)
treedb1e2bf73933dce05797113b68d8fd6240ed5d41 /Documentation/process/coding-style.rst
parentdocs/vm: update 00-INDEX (diff)
downloadkernel-qcow2-linux-1dbba2cf30c9be65287d2c83ad35db72c62890ad.tar.gz
kernel-qcow2-linux-1dbba2cf30c9be65287d2c83ad35db72c62890ad.tar.xz
kernel-qcow2-linux-1dbba2cf30c9be65287d2c83ad35db72c62890ad.zip
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>
Diffstat (limited to 'Documentation/process/coding-style.rst')
-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:
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
***********