Skip to content

Commit fa94614

Browse files
author
MarcoFalke
committed
[doc] dev-notes: Members should be initialized
Also, remove mention of threads that were removed long ago
1 parent f4f4f51 commit fa94614

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

doc/developer-notes.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,8 @@ Threads
238238

239239
- DumpAddresses : Dumps IP addresses of nodes to peers.dat.
240240

241-
- ThreadFlushWalletDB : Close the wallet.dat file if it hasn't been used in 500ms.
242-
243241
- ThreadRPCServer : Remote procedure call handler, listens on port 8332 for connections and services them.
244242

245-
- BitcoinMiner : Generates bitcoins (if wallet is enabled).
246-
247243
- Shutdown : Does an orderly shutdown of everything.
248244

249245
Ignoring IDE/editor files
@@ -380,6 +376,18 @@ C++ data structures
380376
- *Rationale*: Easier to understand what is happening, thus easier to spot mistakes, even for those
381377
that are not language lawyers
382378

379+
- Initialize all non-static class members where they are defined
380+
381+
- *Rationale*: Initializing the members in the declaration makes it easy to spot uninitialized ones,
382+
and avoids accidentally reading uninitialized memory
383+
384+
```cpp
385+
class A
386+
{
387+
uint32_t m_count{0};
388+
}
389+
```
390+
383391
Strings and formatting
384392
------------------------
385393
@@ -415,11 +423,11 @@ member name:
415423
```c++
416424
class AddressBookPage
417425
{
418-
Mode mode;
426+
Mode m_mode;
419427
}
420428
421429
AddressBookPage::AddressBookPage(Mode _mode) :
422-
mode(_mode)
430+
m_mode(_mode)
423431
...
424432
```
425433

src/miner.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@
3030
#include <queue>
3131
#include <utility>
3232

33-
//////////////////////////////////////////////////////////////////////////////
34-
//
35-
// BitcoinMiner
36-
//
37-
38-
//
3933
// Unconfirmed transactions in the memory pool often depend on other
4034
// transactions in the memory pool. When we select transactions from the
4135
// pool, we select by highest fee rate of a transaction combined with all

0 commit comments

Comments
 (0)