You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
Clang-tidy does seem to have a check for this: cppcoreguidelines-pro-type-cstyle-cast, but in my experience it doesn't seem to provide a fixit (even though it should) and it also doesn't diagnose the issue properly in the majority of cases. Although, I probably should test this on various platforms to check whether it's an issue with my configuration.
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 likestatic_cast<float>(value)
, C-style casts are inherently a worse choice. In particular, there are three benefits of using C++ style casts:The text was updated successfully, but these errors were encountered: