mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-08 09:21:06 +02:00
doc: Add note about our preference for scoped enumerations ("enum class")
This commit is contained in:
@ -39,6 +39,7 @@ code.
|
|||||||
- `++i` is preferred over `i++`.
|
- `++i` is preferred over `i++`.
|
||||||
- `nullptr` is preferred over `NULL` or `(void*)0`.
|
- `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.
|
- `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:
|
Block style example:
|
||||||
```c++
|
```c++
|
||||||
|
Reference in New Issue
Block a user