| 395 | } |
| 396 | |
| 397 | void CheckOtherImpl::cstyleCastError(const Token *tok, bool isPtr) |
| 398 | { |
| 399 | const std::string type = isPtr ? "pointer" : "reference"; |
| 400 | reportError(tok, Severity::style, "cstyleCast", |
| 401 | "C-style " + type + " casting\n" |
| 402 | "C-style " + type + " casting detected. C++ offers four different kinds of casts as replacements: " |
| 403 | "static_cast, const_cast, dynamic_cast and reinterpret_cast. A C-style cast could evaluate to " |
| 404 | "any of those automatically, thus it is considered safer if the programmer explicitly states " |
| 405 | "which kind of cast is expected.", CWE398, Certainty::normal); |
| 406 | } |
| 407 | |
| 408 | void CheckOtherImpl::warningDangerousTypeCast() |
| 409 | { |
no test coverage detected