Stupid gcc trick #3: list all built-in gcc #define symbols

Ever wonder whether you should use #ifdef linux … or #ifdef __linux? Ever search /usr/include for the header file that defines __INT_MAX__ … and not find it? These are the little mysteries of gcc’s built-in #defines. However, there’s really no big mystery:

$ gcc -E -dM -</dev/null

will print the list of #defines that gcc provides.
PS you can find where __INT_MAX__ really comes from by using my stupid gcc trick #2.

About mischasan

I've had the privilege to work in a field where abstract thinking has concrete value. That applies at the macro level --- optimizing actions on terabyte database --- or the micro level --- fast parallel string searches in memory. You can find my documents on production-system radix sort (NOT just for academics!) and some neat little tricks for developers, on my blog My e-mail sig (since 1976): Engineers think equations approximate reality. Physicists think reality approximates the equations. Mathematicians never make the connection.
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

1 Response to Stupid gcc trick #3: list all built-in gcc #define symbols

  1. Pingback: The “C” preprocessor: not as cryptic as you’d think | Coding on the edges

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s