I am analyzing a legacy code which heavily usi开发者_如何学运维ng macro, I am lost in understanding how macro are expanding in code.
Could any one suggest me some tool or technique so that I can study actual code generated from macro expansion.
Platform : Windows XP
Language : C++ Compiler : VC6To run the GCC as a pre-processor only do:
gcc -E source-file.cc > processed-source-file.cc
It also do all the #includes that you may or may not want.
With visual studio you can use the Generate Preprocessed File option.
In the properties for your project select
C/C++/Preprocessor/
In that tab there is an option to:
generate a preprocessed file.
Select Yes, with numbers.
Run the pre-processor (cpp) on the source file.
Since you're using Visual C this doesn't help you, but it might be helpful to others to mention:
Netbeans 6.7 is able to display the macro expanded version of C/C++ code in a separate window during editing.
精彩评论