-
Recent Posts
Recent Comments
Categories
Links
Daily Archives: March 29, 2018
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 … Continue reading
Posted in C Language
Leave a comment
C99 _Bool
C99定義了關鍵字 _Bool, 又另外新增了stdbool.h 將 #define bool _Bool #define true 1 #define false 0 為什麼用_Bool這樣看起來有點奇怪的命名而不直接定義bool? 最主要的原因是因為在c89 bool並非保留字, 因此在擴展規範時只能從reserved identifier下手了 在c89的規範 7.1.3第一項提到 All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any … Continue reading
Posted in C Language
Leave a comment