如何确定编译器使用的C ++标准的版本? [英] How to determine the version of the C++ standard used by the compiler?

查看:308
本文介绍了如何确定编译器使用的C ++标准的版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定编译器实现的C ++标准的版本?据我所知,下面是我所认识的标准:

How do you determine what version of the C++ standard is implemented by your compiler? As far as I know, below are the standards I've known:


  • C ++ 03

  • C ++ 98

推荐答案

据我所知, 。如果您查看跨平台/多个编译器支持库的标头,您总是会发现很多的定义,使用编译器特定的结构来确定这样的事情:

By my knowledge there is no overall way to do this. If you look at the headers of cross platform/multiple compiler supporting libraries you'll always find a lot of defines that use compiler specific constructs to determine such things:

/*Define Microsoft Visual C++ .NET (32-bit) compiler */
#if (defined(_M_IX86) && defined(_MSC_VER) && (_MSC_VER >= 1300)
     ...
#endif

/*Define Borland 5.0 C++ (16-bit) compiler */
#if defined(__BORLANDC__) && !defined(__WIN32__)
     ...
#endif


b $ b

你可能必须为你使用的所有编译器自己定义。

You probably will have to do such defines yourself for all compilers you use.

这篇关于如何确定编译器使用的C ++标准的版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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