Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115197
D8430.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D8430.diff
View Options
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -590,12 +590,21 @@
- Vector bounds checking is only enabled in debug mode. Do not rely on it
-- Make sure that constructors initialize all fields. If this is skipped for a
- good reason (i.e., optimization on the critical path), add an explicit
- comment about this
+- Initialize all non-static class members where they are defined.
+ If this is skipped for a good reason (i.e., optimization on the critical
+ path), add an explicit comment about this
- *Rationale*: Ensure determinism by avoiding accidental use of uninitialized
values. Also, static analyzers balk about this.
+ Initializing the members in the declaration makes it easy to
+ spot uninitialized ones.
+
+```cpp
+class A
+{
+ uint32_t m_count{0};
+}
+```
- By default, declare single-argument constructors `explicit`.
@@ -614,18 +623,6 @@
- *Rationale*: Easier to understand what is happening, thus easier to spot mistakes, even for those
that are not language lawyers
-- Initialize all non-static class members where they are defined
-
- - *Rationale*: Initializing the members in the declaration makes it easy to spot uninitialized ones,
- and avoids accidentally reading uninitialized memory
-
-```cpp
-class A
-{
- uint32_t m_count{0};
-}
-```
-
Strings and formatting
------------------------
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 10:15 (7 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187313
Default Alt Text
D8430.diff (1 KB)
Attached To
D8430: docs: Fix conflicting statements about initialization in developer notes
Event Timeline
Log In to Comment