summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAnders Wenhaug <gablank@users.noreply.github.com>2021-06-23 23:39:56 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-06-24 10:06:40 +0900
commit4dbad977ff153f1457fd3ec5bc06b5b7e6414cc0 (patch)
tree7b1fa739d33d39e6b79afd02d5f627a6dc7e36dd /docs
parentb905f3bbba2de0a96a7382492e87ff023598ee23 (diff)
downloadsystemd-4dbad977ff153f1457fd3ec5bc06b5b7e6414cc0.tar.gz
docs: add coding style example
Add example of how to structure else-blocks following a multiline block.
Diffstat (limited to 'docs')
-rw-r--r--docs/CODING_STYLE.md8
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.md
index 09b74d35d8..54150e1ee7 100644
--- a/docs/CODING_STYLE.md
+++ b/docs/CODING_STYLE.md
@@ -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