]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
docs: add coding style example
authorAnders Wenhaug <gablank@users.noreply.github.com>
Wed, 23 Jun 2021 21:39:56 +0000 (23:39 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 24 Jun 2021 01:06:40 +0000 (10:06 +0900)
Add example of how to structure else-blocks following a multiline block.

docs/CODING_STYLE.md

index 09b74d35d8d62cdc5805b7ba22d3a40fdbceba36..54150e1ee7fab36d018afd85f8d864d70c6287ef 100644 (file)
@@ -69,6 +69,14 @@ layout: default
   ```
 
 - Do not write `foo ()`, write `foo()`.
+- `else` blocks should generally start on the same line as the closing `}`:
+  ```c
+  if (foobar) {
+          find();
+          waldo();
+  } else
+          dont_find_waldo();
+  ```
 
 ## Code Organization and Semantics