Pregunta

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!

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top