File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,32 @@ Strings and formatting
331
331
332
332
- * Rationale* : Bitcoin Core uses tinyformat, which is type safe. Leave them out to avoid confusion
333
333
334
+ Variable names
335
+ --------------
336
+
337
+ The shadowing warning (` -Wshadow ` ) is enabled by default. It prevents issues rising
338
+ from using a different variable with the same name.
339
+
340
+ Please name variables so that their names do not shadow variables defined in the source code.
341
+
342
+ E.g. in member initializers, prepend ` _ ` to the argument name shadowing the
343
+ member name:
344
+
345
+ ``` c++
346
+ class AddressBookPage
347
+ {
348
+ Mode mode;
349
+ }
350
+
351
+ AddressBookPage::AddressBookPage(Mode _ mode) :
352
+ mode(_ mode)
353
+ ...
354
+ ```
355
+
356
+ When using nested cycles, do not name the inner cycle variable the same as in
357
+ upper cycle etc.
358
+
359
+
334
360
Threads and synchronization
335
361
----------------------------
336
362
You can’t perform that action at this time.
0 commit comments