Skip to content

Commit 085fe76

Browse files
committed
Merge #16461: doc: Tidy up shadowing section
9452802 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 9452802 ryanofsky: ACK 9452802 fanquake: ACK 9452802 - Thanks for following up. Tree-SHA512: 1fc31355d368225713298da7803e39e99014fbfcd229f2d3b56c082de95ab2965e51c80b172a5abce4646c53f845fa62a6d94d5df714e7835cac07a8ec7d5da7
2 parents 7fbbd6f + 9452802 commit 085fe76

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)
@@ -613,27 +613,13 @@ Strings and formatting
613613
614614
- *Rationale*: Bitcoin Core uses tinyformat, which is type safe. Leave them out to avoid confusion.
615615
616-
Variable names
616+
Shadowing
617617
--------------
618618
619619
Although the shadowing warning (`-Wshadow`) is not enabled by default (it prevents issues arising
620620
from using a different variable with the same name),
621621
please name variables so that their names do not shadow variables defined in the source code.
622622
623-
E.g. in member initializers, prepend `_` to the argument name shadowing the
624-
member name:
625-
626-
```c++
627-
class AddressBookPage
628-
{
629-
Mode m_mode;
630-
}
631-
632-
AddressBookPage::AddressBookPage(Mode _mode)
633-
: m_mode(_mode)
634-
...
635-
```
636-
637623
When using nested cycles, do not name the inner cycle variable the same as in
638624
the upper cycle, etc.
639625

0 commit comments

Comments
 (0)