c语言预处理过程(C language preprocessing process)
c语言预处理过程(C language preprocessing process)
The preprocessing process scans the source code, performs a preliminary conversion, and generates new source code for the compiler. It is evident that the preprocessing process processes the source code earlier than the compiler.
In C, there is no internal mechanism for performing some of the following functions: include other source files at compile time, define macros, and decide whether or not compile contains some code at compile time. To do this, you need to use a preprocessing program. Although most compilers today contain preprocessing programs, they are generally considered to be compiler independent. The preprocessing process reads the source code, checks the statements and macro definitions that contain the preprocessing instructions and responds to the source code. The preprocessing process also removes comments and superfluous whitespace characters in the program.
Pre processing instruction is at the beginning of the line of code to # no.. # number must be the first character in addition to any whitespace character outside. After the instruction is # keywords, allowing any number of whitespace between keywords and # no.. The row statement forms a preprocessing instruction that converts some of the source code before the compiler compiles. Here are some of the preprocessing instructions:
Instruction use
# air command, no effect
#include contains a source code file
#define definition macro
#undef cancels the defined macro
#if if the given condition is true, the following code is compiled
#ifdef if the macro has been defined, the following code is compiled
#ifndef if the macro is not defined, the following code is compiled
#elif if the preceding #if given condition is not true and the current condition is true, the following code is compiled
#endif ends an #if...... #else conditional compilation block
#error stops compiling and displays error messages
First, the file contains
The function of the #include preprocess