Skip to content

Stop using C-style casts in new code #3010

@daljit46

Description

@daljit46

There are several places in our codebase where we are relying on C-style casts instead of using C++ casts. While it's true that writing something like float(value) is shorter and arguably more readable than something like static_cast<float>(value), C-style casts are inherently a worse choice. In particular, there are three benefits of using C++ style casts:

  • they're checked at compile time by the compiler (when it's possible to do so).
  • they express intent much better than C-style casts.
  • they're greppable (very useful when refactoring something).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions