diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-03-05 17:38:56 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-03-05 17:38:59 +0100 |
commit | 21e2670de3bcbcd41fd7655bfac042ab1ff36762 (patch) | |
tree | d0d6acdca06958f6bd59c8c2bf14429db965bb61 /doc/developer-notes.md | |
parent | 07d2d2a21c508050ba0bbe9ba55d5756c96f8909 (diff) | |
parent | fa9461473868132a6a23c672b2eea2d29287855d (diff) |
Merge #12434: [doc] dev-notes: Members should be initialized
fa9461473 [doc] dev-notes: Members should be initialized (MarcoFalke)
Pull request description:
Also, remove mention of threads that were removed long ago.
Motivation:
Make it easier to spot bugs such as #11654 and #12426
Tree-SHA512: 8ca1cb54e830e9368803bd98a8b08c39bf2d46f079094ed7e070b32ae15a6e611ce98d7a614f897803309f4728575e6bc9357fab1157c53d2536417eb8271653
Diffstat (limited to 'doc/developer-notes.md')
-rw-r--r-- | doc/developer-notes.md | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 2ebfb59c08..7402d45743 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -240,12 +240,8 @@ Threads - DumpAddresses : Dumps IP addresses of nodes to peers.dat. -- ThreadFlushWalletDB : Close the wallet.dat file if it hasn't been used in 500ms. - - ThreadRPCServer : Remote procedure call handler, listens on port 8332 for connections and services them. -- BitcoinMiner : Generates bitcoins (if wallet is enabled). - - Shutdown : Does an orderly shutdown of everything. Ignoring IDE/editor files @@ -382,6 +378,18 @@ C++ data structures - *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 ------------------------ @@ -417,11 +425,11 @@ member name: ```c++ class AddressBookPage { - Mode mode; + Mode m_mode; } AddressBookPage::AddressBookPage(Mode _mode) : - mode(_mode) + m_mode(_mode) ... ``` |