Skip to content

Commit 2d97611

Browse files
committed
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
2 parents 0415b1e + 0fee2b4 commit 2d97611

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

doc/developer-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ code.
3939
- `++i` is preferred over `i++`.
4040
- `nullptr` is preferred over `NULL` or `(void*)0`.
4141
- `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 two potential pitfalls/problems with traditional C++ enumerations: implicit conversions to int, and name clashes due to enumerators being exported to the surrounding scope.
4243

4344
Block style example:
4445
```c++

0 commit comments

Comments
 (0)