Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Does Directive 5.7.2 apply to #elif directives?
#1
Is the following intended to be compliant with 5.7.2?

Code:
#if 1
/* some code */
#elif 0
/* some code */
#endif

Presumably this is just as offensive to the spirit of 5.7.2 as #if 0 is but an official position would be appreciated as the Directive only actually mentions #if.
Reply
#2
You're right, it is equally bad.

We may have been too explicit in the description by saying "#if 0". In the next version this may be replaced by something more general, such as  "The preprocessor shall also not be used to 'comment out' code"
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)