1. # define defines constants during compilation
2. # UNDEF cancel constants during compilation
3. # ifdef (Conditional compilation)
# Else
# Endif
Take the following example: # UNDEF debug // cancel the DEBUG constant
# Define debug // defines the DEBUG constant to express debugging results when executing the program
# Ifdef debug // If the DEBUG constant has been defined (during debugging)
# Define dprintk (x) {printk (_ function _ "(% d):" ,__ line _); printk (# X );} // defines the dprintk constant and outputs the current function, the current row.
# Else // If the DEBUG constant is not defined, the current function and other debugging results will not be output.
# Define dprintk (x) (void) (0)
# Endif
_ FUNCTION __,__ line _ is a predefined macro. in addition, "X... ", printk (# X) expresses its own results. dprintk ("ADC opened \ n"); // the result after execution is: "current function row: ADC opened"