C++0x/C++11 Support in GCC

C++0xwas the working name of the ISO C++ 2011 standard, which introduced a host ofnew features into the standard C++ language and library. This project sought toimplement new C++11 features in GCC, and made it the first compiler to bringfeature-complete C++11 to C++ programmers.

C++11 features are available as part of the"mainline" GCC compiler in the trunk of GCC's Subversion repository and in GCC 4.3 and later. To enable C++0x support, add thecommand-line parameter -std=c++0x to your g++ command line. Or, to enable GNUextensions in addition to C++0x extensions, add -std=gnu++0x to your g++command line. GCC 4.7 and later support -std=c++11 and -std=gnu++11 as well.

Important: GCC's support for C++11 is still experimental. Some features were implementedbased on early proposals, and no attempt will be made to maintain backwardcompatibility when they are updated to match the final C++11 standard.

C++11 Language Features

Thefollowing table lists new language features that have been accepted into theC++11 standard. The "Proposal" column provides a link to the ISO C++committee proposal that describes the feature, while the "Available inGCC?" column indicates the first version of GCC that contains animplementation of this feature (if it has been implemented).

Forinformation about C++11 support in a specific version of GCC, please see:

  •  
 

Language Feature

 
 
 

Proposal

 
 
 

Available in GCC?

 
 
 

Rvalue references

 
 
 

N2118

 
 
 

GCC 4.3

 
 
 

    Rvalue  references for *this

 
 
 

N2439

 
 
 

GCC 4.8.1

 
 
 

Initialization  of class objects by rvalues

 
 
 

N1610

 
 
 

Yes

 
 
 

Non-static  data member initializers

 
 
 

N2756

 
 
 

GCC 4.7

 
 
 

Variadic  templates

 
 
 

N2242

 
 
 

GCC 4.3

 
 
 

    Extending  variadic template template parameters

 
 
 

N2555

 
 
 

GCC 4.4

 
 
 

Initializer  lists

 
 
 

N2672

 
 
 

GCC 4.4

 
 
 

Static  assertions

 
 
 

N1720

 
 
 

GCC 4.3

 
 
 

auto-typed  variables

 
 
 

N1984

 
 
 

GCC 4.4

 
 
 

    Multi-declarator  auto

 
 
 

N1737

 
 
 

GCC 4.4

 
 
 

    Removal  of auto as a storage-class specifier

 
 
 

N2546

 
 
 

GCC 4.4

 
 
 

    New  function declarator syntax

 
 
 

N2541

 
 
 

GCC 4.4

 
 
 

New  wording for C++0x lambdas

 
 
 

N2927

 
 
 

GCC 4.5

 
 
 

Declared  type of an expression

 
 
 

N2343

 
 
 

GCC 4.3

 
 
 

    decltype  and call expressions

 
 
 

N3276

 
 
 

GCC 4.8.1

 
 
 

Right  angle brackets

 
 
 

N1757

 
 
 

GCC 4.3

 
 
 

Default  template arguments for function templates

 
 
 

DR226

 
 
 

GCC 4.3

 
 
 

Solving  the SFINAE problem for expressions

 
 
 

DR339

 
 
 

GCC 4.4

 
 
 

Template  aliases

 
 
 

N2258

 
 
 

GCC 4.7

 
 
 

Extern  templates

 
 
 

N1987

 
 
 

Yes

 
 
 

Null  pointer constant

 
 
 

N2431

 
 
 

GCC 4.6

 
 
 

Strongly-typed  enums

 
 
 

N2347

 
 
 

GCC 4.4

 
 
 

Forward  declarations for enums

 
 
 

N2764 

 
 
 

GCC 4.6

 
 
 

Generalized  attributes

 
 
 

N2761

 
 
 

GCC 4.8

 
 
 

Generalized  constant expressions

 
 
 

N2235

 
 
 

GCC 4.6

 
 
 

Alignment  support

 
 
 

N2341

 
 
 

GCC 4.8

 
 
 

Delegating  constructors

 
 
 

N1986

 
 
 

GCC 4.7

 
 
 

Inheriting  constructors

 
 
 

N2540

 
 
 

GCC 4.8

 
 
 

Explicit  conversion operators

 
 
 

N2437

 
 
 

GCC 4.5

 
 
 

New  character types

 
 
 

N2249

 
 
 

GCC 4.4

 
 
 

Unicode  string literals

 
 
 

N2442

 
 
 

GCC 4.5

 
 
 

Raw  string literals

 
 
 

N2442

 
 
 

GCC 4.5

 
 
 

Universal  character name literals

 
 
 

N2170

 
 
 

GCC 4.5

 
 
 

User-defined  literals

 
 
 

N2765

 
 
 

GCC 4.7

 
 
 

Standard  Layout Types

 
 
 

N2342

 
 
 

GCC 4.5

 
 
 

Defaulted  and deleted functions

 
 
 

N2346

 
 
 

GCC 4.4

 
 
 

Extended  friend declarations

 
 
 

N1791

 
 
 

GCC 4.7

 
 
 

Extending  sizeof

 
 
 

N2253

 
 
 

GCC 4.4

 
 
 

Inline  namespaces

 
 
 

N2535

 
 
 

GCC 4.4

 
 
 

Unrestricted  unions

 
 
 

N2544

 
 
 

GCC 4.6

 
 
 

Local  and unnamed types as template arguments

 
 
 

N2657

 
 
 

GCC 4.5

 
 
 

Range-based  for

 
 
 

N2930

 
 
 

GCC 4.6

 
 
 

Explicit  virtual overrides

 
 
 

N2928

 

N3206

 

N3272

 
 
 

GCC 4.7

 
 
 

Minimal  support for garbage collection and reachability-based leak detection

 
 
 

N2670

 
 
 

No

 
 
 

Allowing  move constructors to throw [noexcept]

 
 
 

N3050

 
 
 

GCC 4.6

 
 
 

Defining  move special member functions

 
 
 

N3053

 
 
 

GCC 4.6

 
 
 

Concurrency

 
 
 

 

 
 
 

 

 
 
 

Sequence  points

 
 
 

N2239

 
 
 

Yes

 
 
 

Atomic  operations

 
 
 

N2427

 
 
 

GCC 4.4

 
 
 

Strong  Compare and Exchange

 
 
 

N2748

 
 
 

GCC 4.5

 
 
 

Bidirectional  Fences

 
 
 

N2752

 
 
 

GCC 4.8

 
 
 

Memory  model

 
 
 

N2429

 
 
 

GCC 4.8

 
 
 

Data-dependency  ordering: atomics and memory model

 
 
 

N2664

 
 
 

GCC 4.4

 

(memory_order_consume)

 
 
 

Propagating  exceptions

 
 
 

N2179

 
 
 

GCC 4.4

 
 
 

Abandoning  a process and at_quick_exit

 
 
 

N2440

 
 
 

GCC 4.8

 
 
 

Allow  atomics use in signal handlers

 
 
 

N2547

 
 
 

Yes

 
 
 

Thread-local  storage

 
 
 

N2659

 
 
 

GCC 4.8

 
 
 

Dynamic  initialization and destruction with concurrency

 
 
 

N2660

 
 
 

GCC 4.3

 
 
 

C99 Features in C++11

 
 
 

 

 
 
 

 

 
 
 

__func__  predefined identifier

 
 
 

N2340

 
 
 

GCC 4.3

 
 
 

C99  preprocessor

 
 
 

N1653

 
 
 

GCC 4.3

 
 
 

long  long

 
 
 

N1811

 
 
 

GCC 4.3

 
 
 

Extended  integral types

 
 
 

N1988

 
 
 

Yes

 

C++11 Library Features

The status of the library implementation can be tracked inthis table

Historical Branches

C++0x Concepts Branch

Support for the Concepts feature, which is not part of C++11, is not under activedevelopment at this time. The prototype implementation, ConceptGCC, can be found on the branches/conceptgcc-branch.Previously there was a plan to develop a superior implementation on a separatedevelopment branch, branches/cxx0x-concepts-branch, but not much work was doneon that branch.

For questions related to the use of GCC, please consultthese web pages and the GCCmanuals. If that fails, the gcc-help@gcc.gnu.org mailing list might help. Comments on these web pages andthe development of GCC are welcome on our developer list at gcc@gcc.gnu.org.All of our lists have public archives.

Copyright (C) FreeSoftware Foundation, Inc. Verbatim copying anddistribution of this entire article is permitted in any medium, provided thisnotice is preserved.

These pages are maintained by the GCC team. Last modified 2013-04-24.

 

Pastedfrom <http://gcc.gnu.org/projects/cxx0x.html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值