[PATCH] D126186: [clang-tidy] Extend cert-oop57-cpp to check non-zero memset values

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 23 05:49:09 PDT 2022


aaron.ballman added a comment.

In D126186#3530938 <https://reviews.llvm.org/D126186#3530938>, @njames93 wrote:

> As a side point I'm not sure this change really follows what the rule is trying to enforce. The rule is about not using std::memset to reinitialise objects that aren't trivial. Having said that limiting it to only 0 does seem a little restrictive,

I think this change makes sense for the rule as it's written, per "Do not use std::memset() to initialize an object of nontrivial class type as it may not properly initialize the value representation of the object." The noncompliant example was using zero initialization, but there's nothing inherently special about `0` except for how commonly used it is as a default value.


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

https://reviews.llvm.org/D126186



More information about the cfe-commits mailing list