Skip to content

Commit 9452802

Browse files
committed
doc: Tidy up shadowing section
1 parent fe00192 commit 9452802

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

doc/developer-notes.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Developer Notes
2727
- [General C++](#general-c)
2828
- [C++ data structures](#c-data-structures)
2929
- [Strings and formatting](#strings-and-formatting)
30-
- [Variable names](#variable-names)
30+
- [Shadowing](#shadowing)
3131
- [Threads and synchronization](#threads-and-synchronization)
3232
- [Scripts](#scripts)
3333
- [Shebang](#shebang)
@@ -611,27 +611,13 @@ Strings and formatting
611611
612612
- *Rationale*: Bitcoin Core uses tinyformat, which is type safe. Leave them out to avoid confusion
613613
614-
Variable names
614+
Shadowing
615615
--------------
616616
617617
Although the shadowing warning (`-Wshadow`) is not enabled by default (it prevents issues rising
618618
from using a different variable with the same name),
619619
please name variables so that their names do not shadow variables defined in the source code.
620620
621-
E.g. in member initializers, prepend `_` to the argument name shadowing the
622-
member name:
623-
624-
```c++
625-
class AddressBookPage
626-
{
627-
Mode m_mode;
628-
}
629-
630-
AddressBookPage::AddressBookPage(Mode _mode)
631-
: m_mode(_mode)
632-
...
633-
```
634-
635621
When using nested cycles, do not name the inner cycle variable the same as in
636622
upper cycle etc.
637623

0 commit comments

Comments
 (0)