[PATCH] D14096: [clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-cast
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 1 17:48:53 PST 2015
On Sun, Nov 1, 2015 at 2:31 PM, Joerg Sonnenberger via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> On Tue, Oct 27, 2015 at 06:10:26PM +0000, Samuel Benzaquen via cfe-commits wrote:
>> sbenza added a comment.
>> In http://reviews.llvm.org/D14096#275902, @xazax.hun wrote:
>> > There is already a similar check in the Google package. What are the differences between those two checks? What is the reason we can not just register that check into the core guidelines module?
>> That other check discourages c-style cast in favor of C++ style casts, even if it is a reinterpret_cast. It simply replaces the cstyle cast with an equivalent C++ one. It is basically a stylistic check.
>> This check will warn unsafe cstyle casts, while allowing safe ones like int->uint casts.
>> This one is a safety related check.
> Looking back to the discussion about the C++ style casts, this argument
> makes no sense. For C++ code, reinterpret_cast is clearly preferable
> over C-style casts for all but code size reasons. There seems to be no
> consideration about "safe" uses with reinterpret_cast, so why should C-style casts
> be different?
"Clearly preferable" is kind of debatable, but I don't disagree with
your statement. That being said, this checker isn't concerned with
C++-style casts, so I'm not certain I understand what you would like
to see changed with this checker. Can you elaborate?
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
More information about the cfe-commits