summaryrefslogtreecommitdiffstats
path: root/Documentation/process
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2020-08-24 21:55:58 -0700
committerJonathan Corbet <corbet@lwn.net>2021-02-04 14:40:02 -0700
commit26606ce072d48ab82f640f75ab9673ee10ab4a5a (patch)
tree8f64c8f779dd6115ef0c410d4046ea78497f606c /Documentation/process
parent4ba1d726c45d644525883565ff5850ddc7b4a718 (diff)
downloadlinux-26606ce072d48ab82f640f75ab9673ee10ab4a5a.tar.bz2
coding-style.rst: Avoid comma statements
Commas are not how statements are terminated. Always use semicolons and braces if necessary. Signed-off-by: Joe Perches <joe@perches.com> Link: https://lore.kernel.org/r/2a97b738bba335434461a5a918053a49c1fb6af4.1598331148.git.joe@perches.com Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/process')
-rw-r--r--Documentation/process/coding-style.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index 98227226c4e5..a1e061149e0d 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -69,9 +69,26 @@ something to hide:
if (condition) do_this;
do_something_everytime;
+Don't use commas to avoid using braces:
+
+.. code-block:: c
+
+ if (condition)
+ do_this(), do_that();
+
+Always uses braces for multiple statements:
+
+.. code-block:: c
+
+ if (condition) {
+ do_this();
+ do_that();
+ }
+
Don't put multiple assignments on a single line either. Kernel coding style
is super simple. Avoid tricky expressions.
+
Outside of comments, documentation and except in Kconfig, spaces are never
used for indentation, and the above example is deliberately broken.