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

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 03:48:40 PDT 2023


barannikov88 added a comment.

> 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 between integral types (including enums that are not strongly-typed), functional-style casts are permitted as an alternative to `static_cast`.

Reads good to me as well.

In D151187#4647916 <https://reviews.llvm.org/D151187#4647916>, @jhenderson wrote:

> Updated patch based on my latest proposal. Feedback appreciated!

The changes look different from the proposal. Am I missing something?


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

https://reviews.llvm.org/D151187



More information about the llvm-commits mailing list