Commit 26606ce0 authored by Joe Perches's avatar Joe Perches Committed by Jonathan Corbet

coding-style.rst: Avoid comma statements

Commas are not how statements are terminated.
Always use semicolons and braces if necessary.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Link: https://lore.kernel.org/r/2a97b738bba335434461a5a918053a49c1fb6af4.1598331148.git.joe@perches.comSigned-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 4ba1d726
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment