HomePhabricator

Use static_cast instead of C-style casts for non-fundamental types

Authored by nakihito on Apr 2 2019, 16:34.

Description

Use static_cast instead of C-style casts for non-fundamental types

Summary:
A C-style cast is equivalent to try casting in the following order:

  1. const_cast(...)
  2. static_cast(...)
  3. const_cast(static_cast(...))
  4. reinterpret_cast(...)
  5. 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. Please enter the commit message for your changes. Lines starting

Backport of Core PR10498
https://github.com/bitcoin/bitcoin/pull/10498

Completes T555

Test Plan:
make check
test_runner.py

Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2765

Details

Committed
nakihitoApr 2 2019, 21:28
Pushed
nakihitoApr 2 2019, 21:28
Reviewer
Restricted Owners Package
Differential Revision
D2765: Use static_cast instead of C-style casts for non-fundamental types
Parents
rABCa12048663e1f: Merge #10275: [rpc] Allow fetching tx directly from specified block in…
Branches
Unknown
Tags
Unknown

Event Timeline

Nico Guiton <nico@bitframe.org> committed rABC256ef1e899be: Use static_cast instead of C-style casts for non-fundamental types (authored by Nico Guiton <nico@bitframe.org>).Apr 2 2019, 21:28