Wednesday, September 29, 2010

How to view/verify Macro's code

Tip - To verify code generated by Macro, we can generate preprocessor output file and verify.

Details - We can generate preprocessor output file by using /P compiler option in VC++6(Project settings->C++->General->ProjectOptions). When compiling, a file with <filename>.i will be generated , which will contain the preprocessor output. Sample files are attached. See the Main() function in the attached files.
MacTest.cpp         - Orginal file
MacTest_TraceEnabled.i  - Preprocessor o/p file when macro is enabled MacTest_TraceDisabled.i - Preprocessor o/p file when macro is disabled

References -

1 comment: