是否有预处理器宏可跨平台检测C99? [英] Is there a preprocessor macro to detect C99 across platforms?

查看:59
本文介绍了是否有预处理器宏可跨平台检测C99?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++具有__cplusplus预处理程序定义,可用于检测版本. C有类似的东西吗?

最好我希望它可以在XCode,GCC和Visual Studio版本之间移植.

解决方案

根据Wikipedia上 C99 上的文章

A standard macro __STDC_VERSION__ is defined with value 199901L to indicate that C99 support is available

#if __STDC_VERSION__ >= 199901L
   /*C99*/
#else
  /*Not C99*/
#endif

C++ has a __cplusplus preprocessor define that lets you detect the version. Is there anything similar for C?

Preferably I'd like it to be portable across XCode, GCC, and Visual Studio versions.

解决方案

As per article on Wikipedia on C99

A standard macro __STDC_VERSION__ is defined with value 199901L to indicate that C99 support is available

#if __STDC_VERSION__ >= 199901L
   /*C99*/
#else
  /*Not C99*/
#endif

这篇关于是否有预处理器宏可跨平台检测C99?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆