Comment out

From Wikipedia, the free encyclopedia

Commenting out is the practice of marking source code, or software configuration file, as comments (often block comments). This is often done when the code is redundant or obsolete, but is being left in the source to make the intent of the active code clearer, or when the code in that section is broken and a bypass is needed in order to debug another part of the code.

Commenting out can be onerous in languages that do not have block comments, and has its own hazards in certain languages that do have block comments. For example, in C, the comment delimiters may not be nested, so /*/*Foo*/*/ is the comment /*Foo, followed by the literal code characters */, which can lead to bugs when a section of code containing block comments is commented out. In C, a conditional preprocessor directive should generally be used instead. Some languages, like Haskell, avoid this by allowing the nesting of block comments, so the example above (translated into Haskell) read {-{-Foo-}-} and is actually the comment {-Foo-} and no characters of code.

[edit] External link

This article is based in part on the Jargon File, which is in the public domain.