简体   繁体   中英

Generating and saving code from Macro

I am analyzing a legacy code which heavily using 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 : VC6

To 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.

在源文件上运行预处理器(cpp)。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM