使用预处理器进行注释

使用预处理器指令 #if 0#endif 也可以注释掉大块代码。当代码包含否则不会嵌套的多行注释时,这很有用。

#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) */
...