TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
 
ASML C Coding Standard
Search

Rule:  6.10.1.eChecked automatically with code checker

Synopsis:Don't use "#if 0" as comments
Language:C
Severity Level:7
Category:Preprocessing Directives


Description:

Using "#if 0" as comments has at least 2 disadvantages:

  • The "#if 0" construction is most often used to comment out code. Commenting out code is not recommended because it is not clear why it is commented out. Should it be commented in again at a later stage? Possibly it won't even compile at that time any more. The configuration management system should be used in that case to keep track of code that is (temporarily) not needed any more.
  • Most editors won't highlight code within "#if 0" as comments and it is hard to recognize for human beings that it doesn't concern real code.

Example:

#if 0
    if (status > 0) {
       return error;
    }
#endif