Creating and Saving Code from Macro

I am analyzing legacy code that uses macro heavily, I’m lost in understanding how the macro expands in code.

Can someone suggest me some kind of tool or technique so that I can study the actual code created by the macro extension.

Platform: Windows XP
Language: C ++
Compiler: VC6

+3
source share
4 answers

With visual studio, you can use the Generate Preprocessed File option.

In the properties of your project, select

C/C++/Preprocessor/

There is an option in this tab:

generate a preprocessed file.  

Select Yes, with numbers.

+5
source

To run GCC as a pre-processor, run:

gcc -E source-file.cc > processed-source-file.cc

#includes, .

+6

Run the pre-processor (cpp) in the source file.

+4
source

Since you are using Visual C, this will not help you, but may be useful to others:

Netbeans 6.7 can display an extended version of C / C ++ code in a separate window during editing.

+1
source

Source: https://habr.com/ru/post/1719302/


All Articles