These macros are compiled! Under normal circumstances, all rows in the source program participate in compilation. However, sometimes it is desirable to compile some of the contents only in order to meet certain conditions, which is the condition specified for a part of the content, which is "conditional compilation". It is desirable to compile a set of statements when some qualified conditions is met, and another set of statements are compiled when the condition is not satisfied. The most common form of conditional compile command is: #IFDEF Identifier Procedure 1 #Else block 2 #ENDIF It is: When the identifier has been defined (generally using #define command definition), the block 1 Compile, otherwise the program segment 2 is compiled. The #else section can also be no, ie: #ifdef block 1 #denif here "block" can be a statement group or a command line. This condition is compiled to improve the versatility of the C source program. If a C source program runs on the system on different computer systems, different computers have a certain difference. For example, we have a data type. In the Windows platform, we should use the long type representation, and in other platforms should use FLOAT to indicate, this often requires the necessary modifications to the source program, which reduces the versatility of the program. You can compile the following conditions: #ifdef window #define mytype long #else #EnDePe Float #Endif If you compile the program on Windows, you can compile the following command line: #define on the start of the program: #define MyType Long If the following command line appears before this set of conditions: #define windows 0, the Mytype in the program is replaced with Float. In this way, the source program can be used for different types of computer systems without any modifications. Of course, the above is only a simple case, and other conditions can be designed according to this idea. For example, when debugging a program, it is often desirable to output some of the information required, and this information is no longer output after debugging. You can insert the following conditional compilation segments in the source program: #ifdef debug print ("Device_open (% P) / N", File); #ENDIF If there is the following command line in it: #define debug is running at the program Output the value of the File pointer to debug analysis. Simply delete this define command line after debugging. Some people may think that it is not necessary to compile it, that is, add a batch of printf statements when debugging, remove the printf statement one by debugging. Indeed, this is ok. However, when debugging, the PrintF statement is more time, the modified workload is very large. With conditional compilation, you don't have to delete the printf statement one by one, just remove a "#define debug" command in front, all of which makes all of the DEBUG identifiers to do not work. The role of unified control, like a "switch". Sometimes the following form: #ifndef identifier program segment 1 #ELSE block 2 #ENDIF is only the first line with the first form: "IFDEF" is changed to "IFNDEF".