[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 05:03:50 PDT 2023


aaron.ballman added a comment.

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

> In D151187#4363856 <https://reviews.llvm.org/D151187#4363856>, @mehdi_amini wrote:
>
>> LGTM, but you should probably get a least another one.
>>
>>> I agree with safety and grepable. However, I disagree with cast to void. I believe there is no final decision between cast to void and [[maybe_unused]].
>>
>> Are you arguing that casting to void should be forbidden right now? 
>> The new documentation is not saying anything about a preference, it merely avoids introducing a new prohibition about the `(void)` pattern, which to me seems to match existing practices.
>
> I would prefer to say nothing about cast to void. Preference for named casts is an improvement.

I disagree. We have a *lot* of casts to `(void)` in the code base (approx 4000 times) and those should not be expanded to use a much more visually distracting `static_cast`. IMO, we should be explicit that C-style casting to void is acceptable.


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