show gcc predefined macro


gcc -dM -E - < /dev/null

這邊僅列出有__STDC的作為範例

#define __STDC_HOSTED__ 1
#define __STDC_UTF_16__ 1
#define __STDC_IEC_559__ 1
#define __STDC_ISO_10646__ 201505L
#define __STDC_NO_THREADS__ 1
#define _STDC_PREDEF_H 1
#define __STDC_IEC_559_COMPLEX__ 1
#define __STDC_VERSION__ 201112L
#define __GNUC_STDC_INLINE__ 1
#define __STDC_UTF_32__ 1
#define __STDC__ 1
....

g++ notes: use an empty test.cpp

g++ -std=c++11 -pedantic -dM -E test.cpp

or use "-x c++" option to force c++ compiler (https://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines)

This entry was posted in C Language. Bookmark the permalink.

Leave a Reply