From: Anders Wenhaug Date: Wed, 23 Jun 2021 21:39:56 +0000 (+0200) Subject: docs: add coding style example X-Git-Tag: v249-rc2~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4dbad977ff153f1457fd3ec5bc06b5b7e6414cc0;p=thirdparty%2Fsystemd.git docs: add coding style example Add example of how to structure else-blocks following a multiline block. --- diff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.md index 09b74d35d8d..54150e1ee7f 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