When you comment out large chunks of code, use the"#if 0"than using"/**/"Better, because with"/**/"Comment on a larger paragraph to prevent the commented out code from having nested"/**/", this causes the commented out area of the code to be not the range you want, especially if the commented out code is large, particularly if the code is modified over a period of time. Here by the way conditional compilation (#ifdef,#else, #endif, #if等) for clarification. Here are 3 things:1. Scenario 1: #ifdef _xxxx ... Program Section 1 ...#else..... Program Section 2 ...#endifThis indicates that if the identifier _xxxx has been defined by the # define command, the program Segment 1 is compiled, otherwise the program segment 2 is compiled. Example:#defineNumAnd ......... #ifdef, ..., ..., and so on.---- ----- ---------------NUM printf (()."num has been defined before! :) \ n"); #elseprintf ("Num has never been defined before! :(\ n"); #endif} If the program starts with#defineNUM, which is defined by NUM, will, of course, execute the first printf when it encounters the #ifdef num below. Otherwise a second printf will be executed.I think, with this, can be very convenient to open/turns off a specific feature for the entire program. 2: Scenario 2: #ifndef _xxxx ... Program Section 1 ...#else ..... Program Section 2 ...#endifThe #ifndef is used here, which means if not def. Of course it is the opposite of #ifdef (if the identifier _xxxx is not defined, then execute program segment 1, otherwise execute program segment 2). The example is not to be lifted. 3: Situation 3:#ifConstant..... Program Section 1 ...#else..... Program Section 2 ...#endif This indicates that if the constant is true (not 0, whatever the number, as long as it is not 0), execute program segment 1, otherwise execute program segment 2. If there is an # # need shelf write
C + + #if 1