We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01ab3b9 commit 4520dcdCopy full SHA for 4520dcd
03-Style.md
@@ -274,9 +274,12 @@ Use brace initialization; it does not allow narrowing at compile-time:
274
275
// ... //
276
private:
277
- int m_value{ 0 };
+ int m_value{ 0 }; // allowed
278
+ unsigned m_value_2 { -1 }; // compile-time error, narrowing from signed to unsigned.
279
280
```
281
+
282
283
Prefer {} initialization over alternatives unless you have a strong reason not to.
284
285
Forgetting to initialize a member is a source of undefined behavior bugs which are often extremely hard to find.
0 commit comments