[PATCH] D151187: [doc] Add casting style preference to coding standards
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 23 11:50:03 PDT 2023
mehdi_amini added a comment.
In D151187#4364336 <https://reviews.llvm.org/D151187#4364336>, @barannikov88 wrote:
> Moreover, I find the difference between C-style casts and named casts more of a stylistic issue rather than a safety issue.
> This does not make the issue less important though -- consistency is very important. And for that matter:
>
> $ egrep -r "\(u?int[0-9]+_t\)" llvm | wc -l
> 1943
> $ egrep -r "static_cast<u?int[0-9]+_t>" llvm | wc -l
> 1078
>
> C-style cast wins :)
You picked not the most modern part of the codebase though, I can cherry-pick differently with more recent project to get signal for "code written in the last 5 years" and get a very opposite result:
$ egrep -r "\(u?int[0-9]+_t\)" bolt flang lld mlir | wc -l
186
$ egrep -r "static_cast<u?int[0-9]+_t>" bolt flang lld mlir | wc -l
525
(I'm not making any claim on safety of integer-to-integer casting here)
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