diff options
author | Pasta <pasta@dashboost.org> | 2021-12-17 23:40:06 -0500 |
---|---|---|
committer | pasta <pasta@dashboost.org> | 2022-02-02 00:31:47 +0700 |
commit | 75347236f212f327a5bba10d8a900cc58ebe5de0 (patch) | |
tree | 7528e7ba1cf89c97094f7a0facdb97f759f992a7 /doc/developer-notes.md | |
parent | 807169e10b4a18324356ed6ee4d69587b96a7c70 (diff) |
docs: document c-style cast prohibition
Diffstat (limited to 'doc/developer-notes.md')
-rw-r--r-- | doc/developer-notes.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 1888897856..76aebc55b7 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -104,6 +104,10 @@ code. - `++i` is preferred over `i++`. - `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. + - 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: ```c++ |