]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Clarify the state of C++11 member initialization. 8821/head
authorDavid Wells <drwells@email.unc.edu>
Fri, 20 Sep 2019 23:01:20 +0000 (19:01 -0400)
committerDavid Wells <drwells@email.unc.edu>
Fri, 20 Sep 2019 23:19:33 +0000 (19:19 -0400)
We don't use it for non-constexpr initialization.

doc/doxygen/headers/coding_conventions.h

index 08f09258dfa9e7359960ac941112f1093c5caf39..7ff9a6661d42ab3e5269f12aa51dfc75a6f3c9d5 100644 (file)
@@ -119,7 +119,36 @@ executable.
   then functions.
   <br>
   Exceptions shall be declared at the end of the public section
-  before the non-public sections start.</li>
+  before the non-public sections start.
+  <br>
+  We do not use the C++11-style class member initialization for member variables
+  that are neither <code>static const</code> nor <code>static constexpr</code>;
+  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
+  </li>
 
 <li> If a function has both input and output parameters, usually the
   input parameters shall precede the output parameters, unless there

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.