Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Instead of using /* and */ to comment out blocks of code, use conditional compilation (for example, #if, #ifdef, or #ifndef).:

Code Block
bgColor#ccccff
langc
#if 0  /* Use of critical security function no
        * longer necessary */
security_critical_function();
/* Some other comment */
#endif

...

Tool

Version

Checker

Description

GCC

Include Page
GCC_V
GCC_V

 

Can detect violations of this rule when the -Wcomment flag is used.

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V

cmntdout_tokenuse

Fully implemented

LDRA tool suite

Include Page
LDRA_V
LDRA_V

119 S
302 S

Partially implemented.

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

...

CERT C++ Secure Coding StandardMSC04-CPP. Use comments consistently and in a readable fashion
MISRA - C:2012

Rule 21.2 (advisory)
Rule 2.3
Rule 2.43.1 (required)
Directive 4.4 (advisory)

Bibliography

...