[PATCH] D151187: [doc] Add casting style preference to coding standards

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 12:28:49 PDT 2023

aaron.ballman added a comment.

In D151187#4365572 <https://reviews.llvm.org/D151187#4365572>, @tschuett wrote:

> For the first iteration, I would not ask clang provide fixits to use named casts. I just want reports about fishy casts.

The concern isn't with the fix-it to use a named cast, it's with the definition of "fishy cast".  The language already has constraints for super fishy constructs. You mentioned casting a struct to a bool -- that's already not allowed and you get errors in both C and C++: https://godbolt.org/z/P8WaPv8zT  The tricky part will be the the constructs for which the language allows the cast as it might be reasonable or might not be reasonable, depending on what types and values are involved.

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list