Hello,
The MISRA checker doesn't seem to catch this as a violation of MISRA 10.6:
unsigned int var1 = 5;
It catches it only as a violation of 10.1.
Is this a known bug or a difference in MISRA interpretation?
Thanks, Charlie Johnston
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
The MISRA checker doesn't seem to catch this as a violation of MISRA 10.6:
unsigned int var1 = 5;
It catches it only as a violation of 10.1.
Is this a known bug or a difference in MISRA interpretation?
Thanks, Charlie Johnston
Charlie,
The compiler can't know if the intent was to have 5 be a signed or unsigned literal. According the the MISRA rules on determining the underlying type of a literal, 5 has a signed char underlying type. There is no further analysis the compiler can do. This is a rule that must be enforced manually.