See what the preprocessor is doing
Is there anyway to see wha开发者_Python百科t you code looks like after the preprocessor has done all the substitutions?
For gcc just use the -E switch
gcc -E
-E Stop after the preprocessing stage; do not run the compiler proper. The output is in the form of preprocessed source code, which is sent to the standard output.
That depends on your compiler. With gcc, you would use:
gcc -E source.c
Just a note about system headers (eg <stdio.h>): they are a pain when preprocessed.
gcc -E -nostdinc file.c or cpp -nostdinc file.c will not include expansion of system headers.
As an alternative to gcc-E, you can run cpp on your file.
Eclipse C++ IDE (CDT) has Macro Exploration control, which can be used for:
- Obtaining final macro expansion
- Looking through expansion process step-by-step
This is called Macro Exploration control.
加载中,请稍侯......
精彩评论