开发者

Generating and saving code from Macro

开发者 https://www.devze.com 2022-12-08 06:12 出处:网络
I am analyzing a legacy code which heavily usi开发者_如何学运维ng macro, I am lost in understanding how macro are expanding in code.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消