blob: 549e214b241b116341cb236c3e8bbac96d6e6a0d [file] [log] [blame]
.. title:: clang-tidy - bugprone-suspicious-memory-comparison
Finds potentially incorrect calls to ``memcmp()`` based on properties of the
arguments. The following cases are covered:
**Case 1: Non-standard-layout type**
Comparing the object representations of non-standard-layout objects may not
properly compare the value representations.
**Case 2: Types with no unique object representation**
Objects with the same value may not have the same object representation.
This may be caused by padding or floating-point types.
See also:
`EXP42-C. Do not compare padding data
`FLP37-C. Do not use object representations to compare floating-point values
This check is also related to and partially overlaps the CERT C++ Coding Standard rules
`OOP57-CPP. Prefer special member functions and overloaded operators to C Standard Library functions
`EXP62-CPP. Do not access the bits of an object representation that are not part of the object's value representation