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
This commit is contained in:
Wladimir J. van der Laan 2018-03-05 17:38:56 +01:00
commit 21e2670de3
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D
2 changed files with 14 additions and 12 deletions

View file

@ -240,12 +240,8 @@ Threads
- DumpAddresses : Dumps IP addresses of nodes to peers.dat. - 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. - 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. - Shutdown : Does an orderly shutdown of everything.
Ignoring IDE/editor files 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 - *Rationale*: Easier to understand what is happening, thus easier to spot mistakes, even for those
that are not language lawyers 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 Strings and formatting
------------------------ ------------------------
@ -417,11 +425,11 @@ member name:
```c++ ```c++
class AddressBookPage class AddressBookPage
{ {
Mode mode; Mode m_mode;
} }
AddressBookPage::AddressBookPage(Mode _mode) : AddressBookPage::AddressBookPage(Mode _mode) :
mode(_mode) m_mode(_mode)
... ...
``` ```

View file

@ -30,12 +30,6 @@
#include <queue> #include <queue>
#include <utility> #include <utility>
//////////////////////////////////////////////////////////////////////////////
//
// BitcoinMiner
//
//
// Unconfirmed transactions in the memory pool often depend on other // Unconfirmed transactions in the memory pool often depend on other
// transactions in the memory pool. When we select transactions from the // transactions in the memory pool. When we select transactions from the
// pool, we select by highest fee rate of a transaction combined with all // pool, we select by highest fee rate of a transaction combined with all