Predefined macros

So with the GNU compiler you can use the preprocessor to get a list of the predefined macros:

[code lang=”bash”]
$ cpp -dM /dev/null
[/code]

or if you prefer to invoke the preprocessor via gcc itself:

[code lang=”bash”]
$ gcc -dM -E – < /dev/null
[/code]

This should give you a list similar like:

[code lang=”c”]
#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define __DEC64_DEN__ 0.000000000000001E-383DD
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 2147483647
[/code]

For Microsoft’s Visual C++ compiler I have only found pages like:

For Intel’s C++ compiler I found the following page with predefined macros.

And I find this interesting page with a lot of different compilers and their predefined macros to identify them and their versions, if any.

Edit: I also found how to do this with Clang:

[code lang=”bash”]
$ clang -dD -E – < /dev/null
[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>