06-01-2020, 01:43 PM
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
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>