aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-03-27 18:54:01 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-03-27 18:55:09 +0200
commit2d97611c41d95d70538e877f5527a30e8e21f9fb (patch)
tree20fea595be94849eaa152d4acb2a99bbd820bdfc
parent0415b1e6b2f7d1f4954fc8d83802468e2d7604e2 (diff)
parent0fee2b4180815628bd9be03bbb0217e3f8515b57 (diff)
downloadbitcoin-2d97611c41d95d70538e877f5527a30e8e21f9fb.tar.xz
Merge #12800: doc: Add note about our preference for scoped enumerations ("enum class")
0fee2b4 doc: Add note about our preference for scoped enumerations ("enum class") (practicalswift) Pull request description: Add note about our preference for scoped enumerations (`enum class`). Context: #10742 Tree-SHA512: 0ab3465c2b734240cb38a05c2f6e75f1af54207a0f1a2e8115e7b367fd37e8966a2fc0240c6d4c2c66b6677b5f367eda4f4b783bbaa419777336c17f04adff06
-rw-r--r--doc/developer-notes.md1
1 files changed, 1 insertions, 0 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index 8f06ee4eca..a152f86e17 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -39,6 +39,7 @@ code.
- `++i` is preferred over `i++`.
- `nullptr` is preferred over `NULL` or `(void*)0`.
- `static_assert` is preferred over `assert` where possible. Generally; compile-time checking is preferred over run-time checking.
+ - `enum class` is preferred over `enum` where possible. Scoped enumerations avoid two potential pitfalls/problems with traditional C++ enumerations: implicit conversions to int, and name clashes due to enumerators being exported to the surrounding scope.
Block style example:
```c++