문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top