aboutsummaryrefslogtreecommitdiff
path: root/doc/developer-notes.md
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2017-08-22 22:50:03 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2017-08-22 22:55:19 +0200
commitf1708ef89a38efe857daeb4252c6dfab5b7c258e (patch)
tree154fc96a4189ef41c4fb0d508f564d8090b140a6 /doc/developer-notes.md
parent3e55f13bfc98a6b832697d1d0cfb942dbe2094db (diff)
downloadbitcoin-f1708ef89a38efe857daeb4252c6dfab5b7c258e.tar.xz
Add recommendation: By default, declare single-argument constructors `explicit`
Diffstat (limited to 'doc/developer-notes.md')
-rw-r--r--doc/developer-notes.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index ad15aa662e..2f04d6ee6c 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -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