今天就跟大家聊聊有关对C++11特性支持的C编译器有哪些,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

创新互联专注于企业全网整合营销推广、网站重做改版、容县网站定制设计、自适应品牌网站建设、H5页面制作、购物商城网站建设、集团公司官网建设、成都外贸网站建设公司、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为容县等各大城市提供网站开发制作服务。
GCC的下个版本是4.8,以及Clang即将到来的版本是3.3 。如果你使用Visual Studio 2012,你可以安装2012年11月更新支持C++11额外特征的体验版CTP。
我也对V.13.0的Intel C++编译器感到好奇,虽然它还不是预览版并且我也找不到有关它的新特性的信息。我没找到任何有关这个即将发行版本的编译器的信息。
| Feature | VS2012 Nov CTP | g++ 4.8 | Clang 3.3 | Intel 13.0 |
|---|---|---|---|---|
| auto | Yes | Yes | Yes | Yes |
| decltype | Yes | Yes | Yes | Yes |
| Rvalue references and move semantics | Yes | Yes | Yes | Yes |
| Lambda expressions | Yes | Yes | Yes | Yes |
| nullptr | Yes | Yes | Yes | Yes |
| static_assert | Yes | Yes | Yes | Yes |
| Range based for loop | Yes | Yes | Yes | Yes |
| Trailing return type in functions | Yes | Yes | Yes | Yes |
| extern templates | Yes | Yes | Yes | Yes |
| >> for nested templates | Yes | Yes | Yes | Yes |
| Local and unnamed types as template arguments | Yes | Yes | Yes | Yes |
| Variadic macros | Yes | Yes | Yes | Yes |
| Variadic templates | Yes | Yes | Yes | Yes |
| Default template arguments in function templates | Yes | Yes | Yes | Yes |
| final method keyword | Yes | Yes | Yes | No |
| override method keyword | Yes | Yes | Yes | No |
| Strongly typed enums | Yes | Yes | Yes | Partial |
| Forward declared enums | Yes | Yes | Yes | Partial |
| Initializer lists | Yes | Yes | Yes | Partial |
| explicit type conversion operators | Yes | Yes | Yes | No |
| Raw string literals | Yes | Yes | Yes | No |
| Forwarding constructors | Yes | Yes | Yes | No |
| Template aliases | No | Yes | Yes | Yes |
| Defaulted methods | No | Yes | Yes | Yes |
| Deleted methods | No | Yes | Yes | Yes |
| New built-in types | Partial | Yes | Yes | Partial |
| Alignment support | Partial | Yes | Yes | No |
| Inline namespaces | No | Yes | Yes | No |
| sizeof on non-static data members without an instance | No | Yes | Yes | No |
| Changed restrictions on union members | No | Yes | Yes | No |
| User defined literals | No | Yes | Yes | No |
| Encoding support in literals | No | Yes | Yes | No |
| Arbitrary expressions in template deduction contexts | No | Yes | Yes | Don’t know |
| Non-static data member initializers | No | Yes | Yes | Don’t know |
| noexcept | No | Yes | Yes | Partial |
| constexpr | No | Yes | Yes | Partial |
| C99 compatibility | Partial | Yes | Partial | Yes |
| Generalized attributes | No | Yes | Partial | Yes |
| Thread local storage | Partial | Yes | No | Partial |
| Inheriting constructors | No | Yes | No | No |
| Rvalue references for *this | No | No | Yes | No |
| Minimal support for garbage collection | Yes | No | No | Don’t know |
看起来GCC正取代Clang成为最支持C++11的编译器。Visual Studio已经增加了好几个重要C++11特性,像变参模板,初始化器和原生字。
我真的不能在一个更为细致的层面去评论这些编译器实现到底完成得怎样,还有没有bug。(除了VS2012——我在我的书(《C++11 Rocks》)里详细列出过VS2012最初版本的大量bug)。
看下库的支持情况也是比较有用的。由于各编译器对标准库的支持都有较多小改动,我并不打算对此给出详细的细节。我也打算在这次的比较中省略Intel的库。
我可以说,这些库的主要附件大多由第三方实现提供(随后在下面的表格中展现),尽管这是有各种各样的警告。
微软的库实现中没有那些需求尚未被实现的语言功能的东西,例如 constexpr(如VS2012的最初发行版)。库文件还没有更新,以支持2012年11月在 CTP 提出的编译器功能,如初始化列表和可变参数模板。
GCC 的 libstdc++ 也有些滞后,例如它并不支持正则表达式以及地称并发功能。同样,在很多情况下,它也没有实现 constexpr 方法。
Clang的libc++是100%兼容MacOS的,但是它有部分的特性还不兼容Windows和Linux。
| Feature | MSVC | libstdc++ | libc++ |
|---|---|---|---|
| Concurrency: async/future/promise/packaged_task | Yes | Yes | Yes |
| Concurrency: thread and related | Yes | Yes | Yes |
| Concurrency: condition variables | Yes | Yes | Yes |
| Concurrency: mutexes | Yes | Yes | Yes |
| Concurrency: atomic types and operations | Yes | Yes | Yes |
| Concurrency: relaxed memory ordering and fences | Yes | No | Yes |
| Smart pointers | Yes | Yes | Yes |
| Tuples | Yes | Yes | Yes |
| std::bind | Yes | Yes | Yes |
| std::function | Yes | Yes | Yes |
| Regular expressions | Yes | No | Yes |
| Type traits | Yes | Partial | Yes |
| std::forward_list | Yes | Yes | Yes |
| std::array | Yes | Yes | Yes |
| Hash tables | Yes | Yes | Yes |
| Random number generation | Yes | Yes | Yes |
| Compile time rational numbers (ratio) | Yes | Yes | Yes |
| Time utilities (chrono) | Yes | Yes | Yes |
| Initializer lists | Yes | Yes | Yes |
| Diagnostics (system_error) | Yes | Yes | Yes |
| STL refinements and new algorithms | Yes | Yes | Yes |
| General purpose (move, forward, declval etc.) | Yes | Yes | Yes |
比较高兴的是能看到语言和库的支持在稳步改善。Clang和GCC距离完全支持C++11已经很近了。Visual Studio同样在改善对C++11的支持,令我感到欣慰的是C++编译器的更新都是在主分支上。这份Intel的编译器特征支持列表也越来越多。
看完上述内容,你们对对C++11特性支持的C编译器有哪些有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。
网站标题:对C++11特性支持的C编译器有哪些
本文网址:http://www.jxjierui.cn/article/ihppij.html


咨询
建站咨询
