Question

I wanted to use nested switch case in my code, for example:

switch(Year)
  case 2011:
    switch(Month) // Does it comply according to with MISRA C++ 2008 guidelines?
      case Jan:
        break;
      default:
        break;
    break;
  case 2012:
    break;
  case 2013:
    break;
  default:
    break;

Thank You!

Était-ce utile?

La solution

Ignoring spelling/typo errors, there is no reason why nested switch statements should not comply with the C++ Guidelines - that is common in a state machine - Rule 6-4-3

As an aside, MISRA does not "compile" - MISRA is a set of coding guidelines.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top