MISRAC2012-Rule-10.3
In this section:
Synopsis
(Required) The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category
Enabled by default
Yes
Severity/Certainty
Medium/Medium

Full description
The value of an expression was found assigned to an object with a narrower essential type or a different essential type category.
Coding standards
- MISRA C:2012 Rule-10.3
(Required) The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category
Code examples
The following code example fails the check and will give a warning:
void example(void) {
char a = 'a';
unsigned int b = 10;
b = a;
}
The following code example passes the check and will not give a warning about this issue:
void example(void) {
unsigned int a = 10;
unsigned int b = 5;
b = a;
}