From e3783b00bbe1535118518fba5f8111aa626ba7dc Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 1 Feb 2021 16:10:28 +0100 Subject: [PATCH] coding_style.txt: initializers, control flow --- doc/coding_style.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/coding_style.txt b/doc/coding_style.txt index 6a79674c39..007b77b15c 100644 --- a/doc/coding_style.txt +++ b/doc/coding_style.txt @@ -93,6 +93,24 @@ and the source code always looks good. _Hint:_ In VIM, use the 'set list' and 'set listchars' commands to make tabs and spaces visible. +* If class initializers span multiple lines, put the colon on a separate + line and indent the initializers using one tab. For example: + ! Complicated_machinery(Material &material, Deadline deadline) + ! : + ! _material(material), + ! _deadline(deadline), + ! ... + ! { + ! ... + ! } + +* Preferably place statements that alter the control flow - such as + 'break', 'continue', or 'return' - at the beginning of a separate line, + followed by vertical space (a blank line or the closing brace of the + surrounding scope). + ! if (early_return_possible) + ! return; + Switch statements ~~~~~~~~~~~~~~~~~