04-07-2012, 08:14 AM
I have recently come across two different rule interpretations of the following code:
One MISRA checker insists on the break statement referring to rule 15.2, while the other insists that the break statement is unreachable code according to rule 14.1.
Both rules are required, however, both can not be enforced in this case. Which rule supersedes the other?
Code:
switch(cond)
{
case 0:
{
/* A deliberate infinite loop. */
for ( ; ; ) { }
/* Unreachable break statement. */
break;
}
[ … ]
}
Both rules are required, however, both can not be enforced in this case. Which rule supersedes the other?
<t></t>