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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 01:45:07 PDT 2023


jhenderson added a comment.

I am not at all familiar with implementing things in clang-tidy, so don't have the time or skills to implement said dirty hack.

If we were to exclude integers and enums, then I would suggest the following wording:

> When casting, use `static_cast`, `reinterpret_cast`, and `const_cast` rather than C-style casts. There are two exceptions to this:
>
> - When casting to void to suppress warnings about unused variables (as an alternative to ``[[maybe_unused]]``). Prefer C-style casts in this instance.
> - When casting integral types (including enums), prefer the prevailing style in the area being worked on.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151187/new/

https://reviews.llvm.org/D151187



More information about the llvm-commits mailing list