aboutsummaryrefslogtreecommitdiff
path: root/src/script/standard.h
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-02-08 10:36:35 +0000
committerfanquake <fanquake@gmail.com>2023-02-08 10:36:43 +0000
commit8d69b614cc59fc94dbbde97cadbd2ec1749bd3fd (patch)
treeb06bc0d41aa703f9e5704e561ff332228547ddde /src/script/standard.h
parent1bcabe6f2ac8a64afdf14025eefb606ed07dcf1b (diff)
parent75347236f212f327a5bba10d8a900cc58ebe5de0 (diff)
Merge bitcoin/bitcoin#23810: docs: avoid C-style casts; use modern C++ casts
75347236f212f327a5bba10d8a900cc58ebe5de0 docs: document c-style cast prohibition (Pasta) Pull request description: In the words of practicalswift: ``` A C-style cast is equivalent to try casting in the following order: const_cast(...) static_cast(...) const_cast(static_cast(...)) reinterpret_cast(...) const_cast(reinterpret_cast(...)) By using static_cast<T>(...) explicitly we avoid the possibility of an unintentional and dangerous reinterpret_cast. Furthermore static_cast<T>(...) allows for easier grepping of casts. For a more thorough discussion, see "ES.49: If you must use a cast, use a named cast" in the C++ Core Guidelines (Stroustrup & Sutter). ``` Modern tooling, specifically `-Wold-style-cast` can enable us to enforce never using C-style casts. I believe this is especially important due to the number of C-style casts the codebase is currently being used as a reinterpret_cast. reinterpret_casts are especially dangerous, and should never be done via C-style casts. Update the docs to suggest the use of named cast or functional casts. Top commit has no ACKs. Tree-SHA512: 29a98de396f0c78e32d8a1831319162203c4405a670da5add5da956fcc7df200a1cec162ef1cfac4ddfb02714b66406081d40ed435c7f0f28581cfa24d94fac1
Diffstat (limited to 'src/script/standard.h')
0 files changed, 0 insertions, 0 deletions