mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Add recommendation: By default, declare single-argument constructors explicit
This commit is contained in:
parent
3e55f13bfc
commit
f1708ef89a
@ -332,6 +332,12 @@ C++ data structures
|
||||
- *Rationale*: Ensure determinism by avoiding accidental use of uninitialized
|
||||
values. Also, static analyzers balk about this.
|
||||
|
||||
- By default, declare single-argument constructors `explicit`.
|
||||
|
||||
- *Rationale*: This is a precaution to avoid unintended conversions that might
|
||||
arise when single-argument constructors are used as implicit conversion
|
||||
functions.
|
||||
|
||||
- Use explicitly signed or unsigned `char`s, or even better `uint8_t` and
|
||||
`int8_t`. Do not use bare `char` unless it is to pass to a third-party API.
|
||||
This type can be signed or unsigned depending on the architecture, which can
|
||||
|
@ -15,7 +15,7 @@ class CAddrManTest : public CAddrMan
|
||||
uint64_t state;
|
||||
|
||||
public:
|
||||
CAddrManTest(bool makeDeterministic = true)
|
||||
explicit CAddrManTest(bool makeDeterministic = true)
|
||||
{
|
||||
state = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user