日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
幾個(gè)C編譯器對(duì)C++11特性的支持

距離我上次對(duì)C++11支持的不同編譯器的比較已經(jīng)有大半年了。這次我來根據(jù)這些預(yù)覽版的編譯器的文檔來看下它們是如何堆砌起來的。

在鐵東等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供做網(wǎng)站、網(wǎng)站制作 網(wǎng)站設(shè)計(jì)制作定制網(wǎng)站設(shè)計(jì),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),高端網(wǎng)站設(shè)計(jì),成都營(yíng)銷網(wǎng)站建設(shè),成都外貿(mào)網(wǎng)站建設(shè)公司,鐵東網(wǎng)站建設(shè)費(fèi)用合理。

GCC的下個(gè)版本是4.8,以及Clang即將到來的版本是3.3 。如果你使用Visual Studio 2012,你可以安裝2012年11月更新支持C++11額外特征的體驗(yàn)版CTP。

我也對(duì)V.13.0的Intel C++編譯器感到好奇,雖然它還不是預(yù)覽版并且我也找不到有關(guān)它的新特性的信息。我沒找到任何有關(guān)這個(gè)即將發(fā)行版本的編譯器的信息。

Feature VS2012
Nov CTP
g++ 4.8 Clang 3.3 Intel 13.0
autoYesYesYesYes
decltypeYesYesYesYes
Rvalue references and move semanticsYesYesYesYes
Lambda expressionsYesYesYesYes
nullptrYesYesYesYes
static_assertYesYesYesYes
Range based for loopYesYesYesYes
Trailing return type in functionsYesYesYesYes
extern templatesYesYesYesYes
>> for nested templatesYesYesYesYes
Local and unnamed types as template argumentsYesYesYesYes
Variadic macrosYesYesYesYes
Variadic templatesYesYesYesYes
Default template arguments in function templatesYesYesYesYes
final method keywordYesYesYesNo
override method keywordYesYesYesNo
Strongly typed enumsYesYesYesPartial
Forward declared enumsYesYesYesPartial
Initializer listsYesYesYesPartial
explicit type conversion operatorsYesYesYesNo
Raw string literalsYesYesYesNo
Forwarding constructorsYesYesYesNo
Template aliasesNoYesYesYes
Defaulted methodsNoYesYesYes
Deleted methodsNoYesYesYes
New built-in typesPartialYesYesPartial
Alignment supportPartialYesYesNo
Inline namespacesNoYesYesNo
sizeof on non-static data members without an instanceNoYesYesNo
Changed restrictions on union membersNoYesYesNo
User defined literalsNoYesYesNo
Encoding support in literalsNoYesYesNo
Arbitrary expressions in template deduction contextsNoYesYesDon’t know
Non-static data member initializersNoYesYesDon’t know
noexceptNoYesYesPartial
constexprNoYesYesPartial
C99 compatibilityPartialYesPartialYes
Generalized attributesNoYesPartialYes
Thread local storagePartialYesNoPartial
Inheriting constructorsNoYesNoNo
Rvalue references for *thisNoNoYesNo
Minimal support for garbage collectionYesNoNoDon’t know

看起來GCC正取代Clang成為最支持C++11的編譯器。Visual Studio已經(jīng)增加了好幾個(gè)重要C++11特性,像變參模板,初始化器和原生字。

我真的不能在一個(gè)更為細(xì)致的層面去評(píng)論這些編譯器實(shí)現(xiàn)到底完成得怎樣,還有沒有bug。(除了VS2012——我在我的書(《C++11 Rocks》)里詳細(xì)列出過VS2012最初版本的大量bug)。

看下庫(kù)的支持情況也是比較有用的。由于各編譯器對(duì)標(biāo)準(zhǔn)庫(kù)的支持都有較多小改動(dòng),我并不打算對(duì)此給出詳細(xì)的細(xì)節(jié)。我也打算在這次的比較中省略Intel的庫(kù)。

我可以說,這些庫(kù)的主要附件大多由第三方實(shí)現(xiàn)提供(隨后在下面的表格中展現(xiàn)),盡管這是有各種各樣的警告。

微軟的庫(kù)實(shí)現(xiàn)中沒有那些需求尚未被實(shí)現(xiàn)的語言功能的東西,例如 constexpr(如VS2012的最初發(fā)行版)。庫(kù)文件還沒有更新,以支持2012年11月在 CTP 提出的編譯器功能,如初始化列表和可變參數(shù)模板。

GCC 的 libstdc++ 也有些滯后,例如它并不支持正則表達(dá)式以及地稱并發(fā)功能。同樣,在很多情況下,它也沒有實(shí)現(xiàn) constexpr 方法。

Clang的libc++是100%兼容MacOS的,但是它有部分的特性還不兼容Windows和Linux。

Feature MSVC libstdc++ libc++
Concurrency: async/future/promise/packaged_taskYesYesYes
Concurrency: thread and relatedYesYesYes
Concurrency: condition variablesYesYesYes
Concurrency: mutexesYesYesYes
Concurrency: atomic types and operationsYesYesYes
Concurrency: relaxed memory ordering and fencesYesNoYes
Smart pointersYesYesYes
TuplesYesYesYes
std::bindYesYesYes
std::functionYesYesYes
Regular expressionsYesNoYes
Type traitsYesPartialYes
std::forward_listYesYesYes
std::arrayYesYesYes
Hash tablesYesYesYes
Random number generationYesYesYes
Compile time rational numbers (ratio)YesYesYes
Time utilities (chrono)YesYesYes
Initializer listsYesYesYes
Diagnostics (system_error)YesYesYes
STL refinements and new algorithmsYesYesYes
General purpose (move, forward, declval etc.)YesYesYes

比較高興的是能看到語言和庫(kù)的支持在穩(wěn)步改善。Clang和GCC距離完全支持C++11已經(jīng)很近了。Visual Studio同樣在改善對(duì)C++11的支持,令我感到欣慰的是C++編譯器的更新都是在主分支上。這份Intel的編譯器特征支持列表也越來越多。

誰知道明年這4個(gè)編譯器會(huì)不會(huì)全部支持C++11的特征呢!


文章名稱:幾個(gè)C編譯器對(duì)C++11特性的支持
網(wǎng)站地址:http://www.dlmjj.cn/article/djosdhd.html