Extra Clang Tools 3.9 documentation

clang-tidy - misc-pointer-and-integral-operation

«  misc-non-copyable-objects   ::   Contents   ::   misc-redundant-expression  »

misc-pointer-and-integral-operation

Looks for operation involving pointers and integral types. A common mistake is to forget to dereference a pointer. These errors may be detected when a pointer object is compare to an object with integral type.

Examples:

char* ptr;
if ((ptr = malloc(...)) < nullptr)   // Pointer comparison with operator '<'
  ...                                // Should probably be '!='

if (ptr == '\0')   // Should probably be *ptr
  ...

void Process(std::string path, bool* error) {
  [...]
  if (error != false)  // Should probably be *error
    ...

«  misc-non-copyable-objects   ::   Contents   ::   misc-redundant-expression  »