V2533. MISRA. C-style and functional notation casts should not be performed.

This diagnostic rule is based on the software development guidelines developed by MISRA (Motor Industry Software Reliability Association).

This rule only applies to C++.

C-style and functional casting can convert unrelated types which may lead to an error.

You must explicitly cast types using the operators 'static_cast', 'const_cast' and 'reinterpret_cast'.

Examples, for which the analyzer will issue warnings:

int i;
double d;
size_t s;
void *p;
i = int(p);      //V2533
d = (double)s;   //V2533
s = (size_t)(i); //V2533 
p = (void *)(d); //V2533

Exception: casting to void does not constitute any danger and is used to emphasize that a certain result is not used in any way. Example:


Bugs Found

Checked Projects
Collected Errors
12 970