aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2019-08-29 08:13:07 +0800
committerfanquake <fanquake@gmail.com>2019-08-29 08:16:31 +0800
commit085fe76299dfd4a3308e8bc6e9beff6df72733b7 (patch)
treeeb26caf5e3a49ae72a604810e431a6314f299f27 /doc
parent7fbbd6fbd2b895a4521c5fa33670117525aa49ac (diff)
parent9452802480bd154e23771230bbdfebde1dbaa941 (diff)
downloadbitcoin-085fe76299dfd4a3308e8bc6e9beff6df72733b7.tar.xz
Merge #16461: doc: Tidy up shadowing section
9452802480bd154e23771230bbdfebde1dbaa941 doc: Tidy up shadowing section (João Barbosa) Pull request description: Removes the example because it violates the code format. ACKs for top commit: MarcoFalke: unsigned ACK 9452802480bd154e23771230bbdfebde1dbaa941 ryanofsky: ACK 9452802480bd154e23771230bbdfebde1dbaa941 fanquake: ACK 9452802480bd154e23771230bbdfebde1dbaa941 - Thanks for following up. Tree-SHA512: 1fc31355d368225713298da7803e39e99014fbfcd229f2d3b56c082de95ab2965e51c80b172a5abce4646c53f845fa62a6d94d5df714e7835cac07a8ec7d5da7
Diffstat (limited to 'doc')
-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 d1114b0c73..561f623cd5 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)
@@ -613,27 +613,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 arising
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
the upper cycle, etc.