MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / invalidPointerCastError

Method invalidPointerCastError

lib/checkother.cpp:582–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580
581
582void CheckOtherImpl::invalidPointerCastError(const Token* tok, const std::string& from, const std::string& to, bool inconclusive, bool toIsInt)
583{
584 if (toIsInt) { // If we cast something to int*, this can be useful to play with its binary data representation
585 reportError(tok, Severity::portability, "invalidPointerCast", "Casting from " + from + " to " + to + " is not portable due to different binary data representations on different platforms.", CWE704, inconclusive ? Certainty::inconclusive : Certainty::normal);
586 } else
587 reportError(tok, Severity::portability, "invalidPointerCast", "Casting between " + from + " and " + to + " which have an incompatible binary data representation.", CWE704, Certainty::normal);
588}
589
590
591//---------------------------------------------------------------------------

Callers 1

getErrorMessagesMethod · 0.80

Calls 1

reportErrorFunction · 0.70

Tested by

no test coverage detected