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

来源:互联网 发布:杭州最帅交警网络走红 编辑:程序博客网 时间:2024/06/15 00:06




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

C++11 features are available as part of the "mainline" GCC compiler in the trunk ofGCC's Subversion repository and in GCC 4.3 and later. To enable C++0x support, add the command-line parameter-std=c++0x to your g++ command line. Or, to enable GNU extensions 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 implemented based on early proposals, and no attempt will be made to maintain backward compatibility when they are updated to match the final C++11 standard.

C++11 Language Features

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


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

  • GCC 4.3 C++0x Status
  • GCC 4.4 C++0x Status
  • GCC 4.5 C++0x Status
  • GCC 4.6 C++0x Status
  • GCC 4.7 C++11 Status
  • GCC 4.8 C++11 Status
Language FeatureProposalAvailable in GCC?SD-6 Feature TestRvalue referencesN2118GCC 4.3__cpp_rvalue_references >= 200610    Rvalue references for *thisN2439GCC 4.8.1__cpp_ref_qualifiers >= 200710Initialization of class objects by rvaluesN1610Yes Non-static data member initializersN2756GCC 4.7__cpp_nsdmi >= 200809Variadic templatesN2242GCC 4.3__cpp_variadic_templates >= 200704    Extending variadic template template parametersN2555GCC 4.4 Initializer listsN2672GCC 4.4__cpp_initializer_lists >= 200806Static assertionsN1720GCC 4.3__cpp_static_assert >= 200410auto-typed variablesN1984GCC 4.4     Multi-declarator autoN1737GCC 4.4     Removal of auto as a storage-class specifierN2546GCC 4.4     New function declarator syntaxN2541GCC 4.4 New wording for C++0x lambdasN2927GCC 4.5__cpp_lambdas >= 200907Declared type of an expressionN2343GCC 4.3__cpp_decltype >= 200707    decltype and call expressionsN3276GCC 4.8.1 Right angle bracketsN1757GCC 4.3 Default template arguments for function templatesDR226GCC 4.3 Solving the SFINAE problem for expressionsDR339GCC 4.4 Template aliasesN2258GCC 4.7__cpp_alias_templates >= 200704Extern templatesN1987Yes Null pointer constantN2431GCC 4.6 Strongly-typed enumsN2347GCC 4.4 Forward declarations for enumsN2764GCC 4.6 Generalized attributesN2761GCC 4.8__cpp_attributes >= 200809; __has_cpp_attribute(noreturn) >= 200809; __has_cpp_attribute(carries_dependency) == 0 (not implemented)Generalized constant expressionsN2235GCC 4.6__cpp_constexpr >= 200704Alignment supportN2341GCC 4.8 Delegating constructorsN1986GCC 4.7__cpp_delegating_constructors >= 200604Inheriting constructorsN2540GCC 4.8__cpp_inheriting_constructors >= 200802Explicit conversion operatorsN2437GCC 4.5 New character typesN2249GCC 4.4__cpp_unicode_characters >= 200704Unicode string literalsN2442GCC 4.5__cpp_unicode_literals >= 200710Raw string literalsN2442GCC 4.5__cpp_raw_strings >= 200710Universal character name literalsN2170GCC 4.5 User-defined literalsN2765GCC 4.7__cpp_user_defined_literals >= 200809Standard Layout TypesN2342GCC 4.5 Defaulted and deleted functionsN2346GCC 4.4 Extended friend declarationsN1791GCC 4.7 Extending sizeofN2253GCC 4.4 Inline namespacesN2535GCC 4.4 Unrestricted unionsN2544GCC 4.6 Local and unnamed types as template argumentsN2657GCC 4.5 Range-based forN2930GCC 4.6__cpp_range_based_for >= 200907Explicit virtual overridesN2928
N3206
N3272GCC 4.7 Minimal support for garbage collection and reachability-based leak detectionN2670No Allowing move constructors to throw [noexcept]N3050GCC 4.6 Defining move special member functionsN3053GCC 4.6 ConcurrencySequence pointsN2239Yes Atomic operationsN2427GCC 4.4 Strong Compare and ExchangeN2748GCC 4.5 Bidirectional FencesN2752GCC 4.8 Memory modelN2429GCC 4.8 Data-dependency ordering: atomics and memory modelN2664GCC 4.4
(memory_order_consume) Propagating exceptionsN2179GCC 4.4 Abandoning a process and at_quick_exitN2440GCC 4.8 Allow atomics use in signal handlersN2547Yes Thread-local storageN2659GCC 4.8 Dynamic initialization and destruction with concurrencyN2660GCC 4.3 C99 Features in C++11__func__ predefined identifierN2340GCC 4.3 C99 preprocessorN1653GCC 4.3 long longN1811GCC 4.3 Extended integral typesN1988Yes 

C++11 Library Features

The status of the library implementation can be tracked in this table


0 0
原创粉丝点击