V2003. Explicit conversion from 'float/double' type to signed integer type.

This diagnostic warning was added at the request of users.

The analyzer allows you to detect all the explicit floating-point type conversions to integer signed types.

Consider some examples of constructs the analyzer will generate this diagnostic message on:

float f;
double d;
long double ld;
int i;
short s;
i = int(f); // V2003
s = static_cast<short>(d); // V2003
i = (int)ld;  // V2003

V2004 is a related diagnostic message.

According to Common Weakness Enumeration, potential errors found by using this diagnostic are classified as CWE-681.

Bugs Found

Checked Projects
Collected Errors
13 303