From ec2495b660d827dca99e1d054832da19f4e14f2c Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 20 Sep 2019 19:01:20 -0400 Subject: [PATCH] Clarify the state of C++11 member initialization. We don't use it for non-constexpr initialization. --- doc/doxygen/headers/coding_conventions.h | 31 +++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/doc/doxygen/headers/coding_conventions.h b/doc/doxygen/headers/coding_conventions.h index 08f09258df..7ff9a6661d 100644 --- a/doc/doxygen/headers/coding_conventions.h +++ b/doc/doxygen/headers/coding_conventions.h @@ -119,7 +119,36 @@ executable. then functions.
Exceptions shall be declared at the end of the public section - before the non-public sections start. + before the non-public sections start. +
+ We do not use the C++11-style class member initialization for member variables + that are neither static const nor static constexpr; + i.e., instead of +@code + class Foo + { + int a = 42; + int *b = nullptr; + }; +@endcode + write +@code + class Foo + { + Foo(); + + int a; + int *b; + }; + + + + inline Foo::Foo() + : a(42) + , b(nullptr) + {} +@endcode +
  • If a function has both input and output parameters, usually the input parameters shall precede the output parameters, unless there -- 2.39.5