File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -332,6 +332,12 @@ C++ data structures
332
332
- * Rationale* : Ensure determinism by avoiding accidental use of uninitialized
333
333
values. Also, static analyzers balk about this.
334
334
335
+ - By default, declare single-argument constructors ` explicit ` .
336
+
337
+ - * Rationale* : This is a precaution to avoid unintended conversions that might
338
+ arise when single-argument constructors are used as implicit conversion
339
+ functions.
340
+
335
341
- Use explicitly signed or unsigned ` char ` s, or even better ` uint8_t ` and
336
342
` int8_t ` . Do not use bare ` char ` unless it is to pass to a third-party API.
337
343
This type can be signed or unsigned depending on the architecture, which can
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class CAddrManTest : public CAddrMan
15
15
uint64_t state;
16
16
17
17
public:
18
- CAddrManTest (bool makeDeterministic = true )
18
+ explicit CAddrManTest (bool makeDeterministic = true )
19
19
{
20
20
state = 1 ;
21
21
You can’t perform that action at this time.
0 commit comments