diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2018-03-27 17:00:03 +0200 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2018-03-27 17:18:32 +0200 |
commit | 0fee2b4180815628bd9be03bbb0217e3f8515b57 (patch) | |
tree | 20fea595be94849eaa152d4acb2a99bbd820bdfc /doc | |
parent | 0415b1e6b2f7d1f4954fc8d83802468e2d7604e2 (diff) |
doc: Add note about our preference for scoped enumerations ("enum class")
Diffstat (limited to 'doc')
-rw-r--r-- | doc/developer-notes.md | 1 |
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++ |