Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 20.8 and #elif
#1
It is pretty clear from the Amplification that this is not a violation of Rule 20.8:
Code:
#if 0
  #if 10  /* not evaluated, not a violation */
  #endif
#endif
and that this is:
Code:
#if 0
#elif 20  /* evaluated, violation */
#endif
but is the following intended to be a violation of this rule?:
Code:
#if 1
#elif 20  /* ??? */
#endif
It is not clear if the preprocessing directive #elif 20 is evaluated for the purpose of this rule.
<t></t>
#2
Code:
#if 1
#elif 20  /* rule 20.8 does not apply */
#endif
The #elif is considered to be in the code that is excluded and does not affect whether the code is excluded or not. Therefore the rule does not apply to the #elif controlling expression.
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 2 Guest(s)