------ Java training, Android training, IOS training, and. Net training. We look forward to communicating with you! -------
1. Preprocessing commands are operations performed before the code is translated into 0 and 1.
2. Pre-processing commands start with # And can be written at random.
3. The pre-processing instruction scope starts from the preparation of the instruction to the end of the file, but the # UNDEF can cancel the macro definition.
I. macro definition
1. Definition: # define kcount 4. macro names generally start with uppercase or K, and variable names generally start with lowercase letters.
2. application Scenario: If a variable is frequently used, we can use macro definitions, such as PI and circumference rate. The advantage is that it can improve program performance and save memory, the macro definition is executed before the code is translated into 0 and 1, so the system will not allocate space.
3. macro definition knowledge is simply replaced and not responsible for computing. macro definition with parameters is more efficient than Function
Ii. Conditional compilation
1. Definition
# If (condition)
# Elif (condition)
# Endif
# Ifdef
# Endif
# Ifndef
# Endif
This definition is generally used at the beginning of the header file, which can prevent files from being # include multiple times and control performance.
2. conditional compilation is generally used together with macro definition. It can be used to compile a piece of code. Sometimes, when the conditions are not met, Conditional compilation can be used without compiling a piece of code, it can greatly improve the program performance.
3. File Inclusion
1. Keyword # include, which is generally used at the beginning of a file, indicates that if you want to use a file, you can use # include, which is equivalent to a copy.
2. If the system file is used, use # include <>. If the file is used for self-writing, use # include "".
Black Horse programmer ___ preprocessing command