MISRAC2012-Rule-10.5
In this section:
Synopsis
(Advisory) The value of an expression should not be cast to an inappropriate essential type.
Enabled by default
No
Severity/Certainty
Low/Medium

Full description
A value of an expression was found that is cast to an inappropriate essential type.
Coding standards
- MISRA C:2012 Rule-10.5
(Advisory) The value of an expression should not be cast to an inappropriate essential type
Code examples
The following code example fails the check and will give a warning:
#include <stdbool.h>
void example(void) {
bool a = false;
int s32a = (int) a;
}
The following code example passes the check and will not give a warning about this issue:
#include <stdbool.h>
void example(void) {
bool a = false;
bool b = (bool) a;
}