Versions Compared

Key

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

...

Do not use the character sequence /* within a comment:

Code Block
bgColor#FFcccc
/* comment with end comment marker unintentionally omitted
security_critical_function();
/* some other comment */

...

Because missing end deliminators is are error prone and often viewed as a mistake, it is recommended that this approach not be used to comment out code.

...

The text inside a block of code commented-out using #if, #ifdef, or #ifndef must still consist of valid preprocessing tokens. This means that the characters " and ' must each be paired just as in real C code, and the pairs must not cross line boundaries. In particular, an apostrophe within a contracted word looks like the beginning of a character constant. Therefore, natural-language comments and pseudocode should always be written between the comment delimiters /* and */ or following //.

Compliant Solution (compiler)

This compliant solution takes advantage of the compiler's ability to remove unreachable (dead) code.   The code inside the if block must remain acceptable to the compiler.   If other parts of the program such as macros, types, or function prototypes change later in a way that would cause syntax errors, the unexecuted code must be brought up to date to correct the problem.   Then, if it is needed again in the future, all that must be done is to remove the surrounding if statement and the NOTREACHED comment.

...