aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorArne Morten Kvarving <spiff@kodi.tv>2018-08-07 10:02:49 +0200
committerArne Morten Kvarving <spiff@kodi.tv>2018-08-07 10:21:28 +0200
commit066d6e00c599c1d6000d04c75483c42b0835dc87 (patch)
tree227c71495dab78a058a656e555c55e2413499ab5 /docs
parent7a4650fcc41b60bd04ac8370039b156f68fd87bd (diff)
Add default member initialization to code guide lines
Diffstat (limited to 'docs')
-rw-r--r--docs/CODE_GUIDELINES.md13
-rw-r--r--docs/doxygen/CODING_GUIDELINES.dox11
2 files changed, 22 insertions, 2 deletions
diff --git a/docs/CODE_GUIDELINES.md b/docs/CODE_GUIDELINES.md
index c63d220fe3..42d242ba69 100644
--- a/docs/CODE_GUIDELINES.md
+++ b/docs/CODE_GUIDELINES.md
@@ -27,7 +27,8 @@
12.1. **[Casts](#121-casts)**
12.2. **[NULL vs nullptr](#122-null-vs-nullptr)**
12.3. **[auto](#123-auto)**
- 12.4. **[for loops](#124-for-loops)**
+ 12.4. **[for loops](#124-for-loops)**
+ 12.5. **[Default member initialization](#125-default-member-initialization)**
## 1. Motivation
When working in a large group, the two most important values are readability and maintainability. We code for other people, not computers. To accomplish these goals, we have created a unified set of code conventions.
@@ -344,5 +345,13 @@ for (const auto& : var)
```
Remove `const` if the value has to be modified.
-**[back to top](#table-of-contents)**
+### 12.5. Default member initialization
+Use default member initialization instead of initializer lists or constructor assignments whenever it makes sense.
+```cpp
+class Foo
+{
+ bool bar = false;
+};
+```
+**[back to top](#table-of-contents)**
diff --git a/docs/doxygen/CODING_GUIDELINES.dox b/docs/doxygen/CODING_GUIDELINES.dox
index f1dde476b5..df9843bdff 100644
--- a/docs/doxygen/CODING_GUIDELINES.dox
+++ b/docs/doxygen/CODING_GUIDELINES.dox
@@ -394,4 +394,15 @@ for (auto& : var)
Use const auto& if there's no reason to modify the value.
+--------------------------------------------------------------------------------
+\subsection code_guidelines_6_5 default member initialization
+
+Use default member initialization instead of initializer lists or constructor assignments whenever it makes sense.
+~~~~~~~~~~~~~
+class Foo
+{
+ bool bar = false;
+};
+~~~~~~~~~~~~~
+
*/