computer:c:tips:stdc_version
这是本文档旧的修订版!
用预定义宏判断C标准的版本
预定义宏__STC__和__STDC_VERSION__的配合使用,可以让我们编写兼容各种C标准的代码。
如下是一个典型的模板:
#ifdef __STDC__ /* Some version of Standard C */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199409L /* C89 and Amendent 1 */ #else /* C89 but not Amendent 1 */ #endif #else /* Not Standard C */ #endif
computer/c/tips/stdc_version.1409912417.txt.gz · 最后更改: 2014/11/01 02:02 (外部编辑)