MISRA C:2012 Rule 20.5 applicable for inactive code ?

Moderators: misra-c, david ward

Post Reply
Girish
Posts: 1
Joined: Wed Feb 05, 2014 6:56 am
Company: Robert Bosch Engineering and Business Solutions Limited

MISRA C:2012 Rule 20.5 applicable for inactive code ?

Post by Girish » Mon Jan 06, 2020 1: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

Post Reply

Return to “8.20 Preprocessing directives”