Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 799
Tyler Avatar asked Sep 19 '08 23:09

Tyler


1 Answers

gcc -E will output the preprocessed source to stdout.

like image 198
dvorak Avatar answered Sep 25 '22 20:09

dvorak