Search code examples
c#c++ccommentsblock-comments

Including */ in a C-style block comment


Is there any way to include */ in a C-style block comment? Changing the block comment to a series of line comments (//) is not an option in this case.

Here's an example of the sort of comment causing a problem:

/**
 * perl -pe 's/(?<=.{6}).*//g' : Limit to PID
 */

Solution

  • Usually comments don't need to be literal, so this doesn't come up too often.

    You can wrap it all in a #if block:

    #if 0
    whatever you want can go here, comments or not
    #endif