Commenting using the preprocessor

suggest change

Large chunks of code can also be “commented out” using the preprocessor directives #if 0 and #endif. This is useful when the code contains multi-line comments that otherwise would not nest.

#if 0 /* Starts the "comment", anything from here on is removed by preprocessor */ 

/* A large amount of code with multi-line comments */  
int foo()
{
    /* lots of code */
    ...

    /* ... some comment describing the if statement ... */
    if (someTest) {
        /* some more comments */
        return 1;
    }

    return 0;
}

#endif /* 0 */

/* code from here on is "uncommented" (included in compiled executable) */
...

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents