gcc defines some macros based on the platform, architecture, etc that it is running on. I always forget the gcc arguments that makes it display all these macro definitions, so here's a reminder for myself.
foo.c can be anything, even an empty file (gcc only pre-processes the file).
Here's an ultra-simple mini script that takes care of the temp file creation.
gcc_macros.sh:
If I run this script on my Mac I get a large list of macro definitions, i.e.:
and so on.
gcc -E -dM foo.c
foo.c can be anything, even an empty file (gcc only pre-processes the file).
Here's an ultra-simple mini script that takes care of the temp file creation.
gcc_macros.sh:
#!/bin/sh tmpfile=/var/tmp/foo.c touch $tmpfile gcc -E -dM $tmpfile rm $tmpfile
If I run this script on my Mac I get a large list of macro definitions, i.e.:
$ ./gcc_macros.sh #define __DBL_MIN_EXP__ (-1021) #define __FLT_MIN__ 1.17549435e-38F #define __CHAR_BIT__ 8 #define __WCHAR_MAX__ 2147483647 #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __FLT_EVAL_METHOD__ 0 #define __DBL_MIN_10_EXP__ (-307) #define __FINITE_MATH_ONLY__ 0 #define __SHRT_MAX__ 32767 #define __LDBL_MAX__ 1.18973149535723176502e+4932L #define __APPLE_CC__ 5465 #define __UINTMAX_TYPE__ long long unsigned int #define __SCHAR_MAX__ 127 #define __USER_LABEL_PREFIX__ _ #define __STDC_HOSTED__ 1 #define __DBL_DIG__ 15 #define __FLT_EPSILON__ 1.19209290e-7F #define __LDBL_MIN__ 3.36210314311209350626e-4932L #define __strong #define __APPLE__ 1 #define __DECIMAL_DIG__ 21 #define __LDBL_HAS_QUIET_NAN__ 1 #define __DYNAMIC__ 1 #define __GNUC__ 4 #define __MMX__ 1
and so on.
- Location:Home/office
