09-10-2014, 08:36 AM
Code:
#include
typedef enum{ NOT_OK, OK, MAYBE } assessment;
void foo (assessment a)
{
bool result;
result = (bool) NOT_OK; /* [1] compliant with MISRA C:2012 Rule 10.5? */
/*. . . */
result = (bool) a; /* [2] not compliant with MISRA C:2012 Rule 10.5? */
/*. . . */
}
Am I correct to say that [1] is compliant with rule 10.5, but [2] is not compliant?
Posted by and on behalf of the MISRA C Working Group