There are many GCC parameters. Here is a very important parameter-e.
If we just want to pre-process the source file,-E will be useful.
What can it do?
(1) Expand All predefined # define defined by the user.
For example, if you have the following code:
# Define max (A, B) (a)> (B )? (A) (B ))
...
Int c = max (A, B );
After GCC preprocessing, the pre-definition will be expanded as follows:
Int c = (a)> (B )? (A) (B ));
(2) load all the # include files.
If we have # include <stdio. h>, after preprocessing, the program will replace it with the content of stdio. h # include <stdio. h>,
In the final program, you will not be able to find such include, more of which are # include "/usr/include/stdio. H.
With this, you can know a) stdio. h storage path in Linux, B) file structure samples, c) size_t type definition, d) many other things you want to know
(3) process Conditional compilation and delete code segments that do not meet the criteria.
For example, there is a code segment:
# Ifdef m
Printf ("M ");
# Else
Printf ("Nm ");
# Endif
After preprocessing, the program will become
Printf ("M ");
(Because no # define m is available and other rows are left blank, the Code printf ("Nm") will be deleted)
How to use it?
Easy to use: gcc-e a. C.
If you want to save the result, redirect it to a file, such as gcc-e. c> B. c. c Compilation: gcc-o B. c. The running effect is the same as that of. c)