aboutsummaryrefslogtreecommitdiff
path: root/doc/developer-notes.md
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-07-25 16:46:49 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-08-28 18:52:53 +0100
commit9452802480bd154e23771230bbdfebde1dbaa941 (patch)
treeb15fa999c3848669f55cb5766dbf9cc6fb853d6e /doc/developer-notes.md
parentfe001925f803ee9281c73da1265c401ba6a2b5ca (diff)
downloadbitcoin-9452802480bd154e23771230bbdfebde1dbaa941.tar.xz
doc: Tidy up shadowing section
Diffstat (limited to 'doc/developer-notes.md')
-rw-r--r--doc/developer-notes.md18
1 files changed, 2 insertions, 16 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index 39463dc6f8..1ff5268218 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -27,7 +27,7 @@ Developer Notes
- [General C++](#general-c)
- [C++ data structures](#c-data-structures)
- [Strings and formatting](#strings-and-formatting)
- - [Variable names](#variable-names)
+ - [Shadowing](#shadowing)
- [Threads and synchronization](#threads-and-synchronization)
- [Scripts](#scripts)
- [Shebang](#shebang)
@@ -611,27 +611,13 @@ Strings and formatting
- *Rationale*: Bitcoin Core uses tinyformat, which is type safe. Leave them out to avoid confusion
-Variable names
+Shadowing
--------------
Although the shadowing warning (`-Wshadow`) is not enabled by default (it prevents issues rising
from using a different variable with the same name),
please name variables so that their names do not shadow variables defined in the source code.
-E.g. in member initializers, prepend `_` to the argument name shadowing the
-member name:
-
-```c++
-class AddressBookPage
-{
- Mode m_mode;
-}
-
-AddressBookPage::AddressBookPage(Mode _mode)
- : m_mode(_mode)
-...
-```
-
When using nested cycles, do not name the inner cycle variable the same as in
upper cycle etc.