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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 03:58:03 PDT 2023


jhenderson added a comment.

In D151187#4647962 <https://reviews.llvm.org/D151187#4647962>, @barannikov88 wrote:

>> 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?

Apologies, I must have copied the wrong block or something. Will update now.


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

https://reviews.llvm.org/D151187



More information about the llvm-commits mailing list