2012-04-26 Computers

Getting the predefined macros from GCC

Getting the predefined macros from a compiler might be the first thing you should do to learn your tools but in my case it seem to be the last thing I do. To get to the info has in my case often required reading through long an boring manuals. However in the case of gcc there is simple way to get the info directly from the compiler itself.

It goes like this.

echo | gcc -E -dM -

The option -E tells gcc just to run the preprocessor. -dM tells the preprocssor to output all defines.

The final twist is to use stdin to enter the code which in this case is just whitespace. There are other ways do that but I like this pipe version.