File tree Expand file tree Collapse file tree 1 file changed +2
-16
lines changed Expand file tree Collapse file tree 1 file changed +2
-16
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ Developer Notes
27
27
- [ General C++] ( #general-c )
28
28
- [ C++ data structures] ( #c-data-structures )
29
29
- [ Strings and formatting] ( #strings-and-formatting )
30
- - [ Variable names ] ( #variable-names )
30
+ - [ Shadowing ] ( #shadowing )
31
31
- [ Threads and synchronization] ( #threads-and-synchronization )
32
32
- [ Scripts] ( #scripts )
33
33
- [ Shebang] ( #shebang )
@@ -611,27 +611,13 @@ Strings and formatting
611
611
612
612
- *Rationale*: Bitcoin Core uses tinyformat, which is type safe. Leave them out to avoid confusion
613
613
614
- Variable names
614
+ Shadowing
615
615
--------------
616
616
617
617
Although the shadowing warning (`-Wshadow`) is not enabled by default (it prevents issues rising
618
618
from using a different variable with the same name),
619
619
please name variables so that their names do not shadow variables defined in the source code.
620
620
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
-
635
621
When using nested cycles, do not name the inner cycle variable the same as in
636
622
upper cycle etc.
637
623
You can’t perform that action at this time.
0 commit comments