Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MISRA C:2012 Rule 20.5 applicable for inactive code ?
#1
Hello,

MISRA C:2012 Rule 20.5 - #undef should not be used.

For the following code snippet, #undef is seen at line 5 and 8.
As Rule 20.5 complains for use of #undef, please let us know whether code at line 8, which is inactive code due to #else is Non-compliant or not according MISRA C:2012 Rule 20.5 ?


1. #define FLAG 100
2.
3. #ifdef FLAG
4. #define L 0
5. #undef L
6. #else
7. #define X 0
8. #undef X
9. #endif

Regards
Girish.M
<t></t>
#2
The Glossary defines Code as "Code consists of everything within a translation unit that is not excluded by conditional compilation"

As such, the #undef at line 8 is excluded from analysis - that does not make it compliant or non-compliant
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 1 Guest(s)