Alex Rivera | Logout

Is there a good general method for debugging C++ macros?

Asked 2008-09-19T23:36:34.090
13

In general, I occasionally have a chain of nested macros with a few preprocessor conditional elements in their definitions. These can be painful to debug since it's hard to directly see the actual code being executed.

A while ago I vaguely remember finding a compiler (gcc) flag to expand them, but I had trouble getting this to work in practice.

Edit
Report

1 Answer

14

gcc -E will output the preprocessed source to stdout.

answered 2008-09-19T23:39:31.290

Your Answer