Reputation: 2405
Rather than right clicking on the macro identifier and then on "go to definition", is it possible to expand macro references and see what the code that is passed to the compiler looks like?
Upvotes: 20
Views: 20997
Reputation: 1311
You can see the macro expansion in the quick info tooltips since VS2017. A very cool new feature.
Macro Expansions in Quick Info Tooltips
Upvotes: 4
Reputation: 149
I heard all possible negative answers on the topic:
They are all true, but IMO they collide with the reality of everydays programming.
In fact, working on old C project where macros, where mostly simply used as functions, this became of crucial importance for me. Generating all preprocessed files with /P works but is overkilling and time taking. I just needed a tool that expands a simple macro defined a few lines above or at maximum in other file.
How to do that?
So, Yes, in a practical sense, it is possible.
Upvotes: 6
Reputation: 2405
"Project + Properties, C/C++, Preprocessor, Preprocess to a File = Yes. Compile and open the .i file in the build directory.
Upvotes: 23