mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
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
This commit is contained in:
parent
7fcb8f53ed
commit
ee46c9545e
@ -26,7 +26,7 @@ Developer Notes
|
|||||||
- [General C++](#general-c)
|
- [General C++](#general-c)
|
||||||
- [C++ data structures](#c-data-structures)
|
- [C++ data structures](#c-data-structures)
|
||||||
- [Strings and formatting](#strings-and-formatting)
|
- [Strings and formatting](#strings-and-formatting)
|
||||||
- [Variable names](#variable-names)
|
- [Shadowing](#shadowing)
|
||||||
- [Threads and synchronization](#threads-and-synchronization)
|
- [Threads and synchronization](#threads-and-synchronization)
|
||||||
- [Source code organization](#source-code-organization)
|
- [Source code organization](#source-code-organization)
|
||||||
- [GUI](#gui)
|
- [GUI](#gui)
|
||||||
@ -577,27 +577,13 @@ Strings and formatting
|
|||||||
|
|
||||||
- *Rationale*: Dash Core uses tinyformat, which is type safe. Leave them out to avoid confusion
|
- *Rationale*: Dash 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
|
Although the shadowing warning (`-Wshadow`) is not enabled by default (it prevents issues rising
|
||||||
from using a different variable with the same name),
|
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.
|
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
|
When using nested cycles, do not name the inner cycle variable the same as in
|
||||||
upper cycle etc.
|
upper cycle etc.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user