mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
docs: document c-style cast prohibition
This commit is contained in:
parent
807169e10b
commit
75347236f2
1 changed files with 4 additions and 0 deletions
|
@ -104,6 +104,10 @@ 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.
|
||||||
|
- Use a named cast or functional cast, not a C-Style cast. When casting
|
||||||
|
between integer types, use functional casts such as `int(x)` or `int{x}`
|
||||||
|
instead of `(int) x`. When casting between more complex types, use static_cast.
|
||||||
|
Use reinterpret_cast and const_cast as appropriate.
|
||||||
|
|
||||||
Block style example:
|
Block style example:
|
||||||
```c++
|
```c++
|
||||||
|
|
Loading…
Add table
Reference in a new issue