Skip to content

Commit 7534723

Browse files
docs: document c-style cast prohibition
1 parent 807169e commit 7534723

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/developer-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ code.
104104
- `++i` is preferred over `i++`.
105105
- `nullptr` is preferred over `NULL` or `(void*)0`.
106106
- `static_assert` is preferred over `assert` where possible. Generally; compile-time checking is preferred over run-time checking.
107+
- Use a named cast or functional cast, not a C-Style cast. When casting
108+
between integer types, use functional casts such as `int(x)` or `int{x}`
109+
instead of `(int) x`. When casting between more complex types, use static_cast.
110+
Use reinterpret_cast and const_cast as appropriate.
107111

108112
Block style example:
109113
```c++

0 commit comments

Comments
 (0)