Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MISRA switch staement
#2
I assume you mean fully compliant, right?

Code:
switch (i)/* essentially integer (for bool use if/else), needs at least two clauses*/
{
  case 0:/* empty fallthrough compliant*/
  case 1:
    doSomething();/* statement or comment required*/
    break;/* unconditional break in every case clause required
  default:/* default case required as last (or first) clause*/
    /* statement or comment required*/
    break;/* unconditional break in default required*/
}
<t></t>


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)