Add note about our preference for scoped enumerations (enum class).
Context: #10742
Add note about our preference for scoped enumerations (enum class).
Context: #10742
38 | @@ -39,6 +39,7 @@ code. 39 | - `++i` is preferred over `i++`. 40 | - `nullptr` is preferred over `NULL` or `(void*)0`. 41 | - `static_assert` is preferred over `assert` where possible. Generally; compile-time checking is preferred over run-time checking. 42 | + - `enum class` is preferred over `enum` where possible. Scoped enumerations avoid three potential pitfalls/problems with traditional C++ enumerations: 1.) implicit conversions to int, 2.) name clashes due to enumerators being exported to the surrounding scope, and 3.) inability to specify the underlying type of the enum.
I had the impression it was possible to specify the type even for the "deprecated" enum.
@MarcoFalke Ah, you're right. Forward declaration of enum:s was fixed in C++11. Will update!
It's ok, avoiding scope leak is the best argument for using scoped enums anyway.
Concept ACK
ACK 0fee2b4180815628bd9be03bbb0217e3f8515b57