반응형




GCC 에서 지원하는 C++11 피쳐들을 알아보자.


gcc 4.9 에서는 c++11 피쳐가 지원된다는 것은 알고 있을겁니다.


그런데, gcc 4.6에서도  c++11 이 지원된다고 아셨다면, 아래 표를 참조해서 내가 쓸수 있는 피쳐와 그렇지 못한 피쳐를 확인해야 합니다.


gcc 4.6 부터 c++11 피쳐들이 100% 지원되는 것이 아니기 때문이죠.


대표적으로 유용한 override keyword 는 4.7 부터 지원하고 있죠.



<참고  : https://gcc.gnu.org/projects/cxx-status.html#cxx11>

Language FeatureProposalAvailable in GCC?SD-6 Feature Test
Rvalue referencesN2118GCC 4.3__cpp_rvalue_references >= 200610
    Rvalue references for *thisN2439GCC 4.8.1__cpp_ref_qualifiers >= 200710
Initialization of class objects by rvaluesN1610Yes
Non-static data member initializersN2756GCC 4.7__cpp_nsdmi >= 200809
Variadic templatesN2242GCC 4.3__cpp_variadic_templates >= 200704
    Extending variadic template template parametersN2555GCC 4.4
Initializer listsN2672GCC 4.4__cpp_initializer_lists >= 200806
Static assertionsN1720GCC 4.3__cpp_static_assert >= 200410
auto-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 >= 200907
Declared 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 >= 200704
Extern 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 >= 200704
Alignment supportN2341GCC 4.8
Delegating constructorsN1986GCC 4.7__cpp_delegating_constructors >= 200604
Inheriting constructorsN2540GCC 4.8__cpp_inheriting_constructors >= 200802
Explicit conversion operatorsN2437GCC 4.5
New character typesN2249GCC 4.4__cpp_unicode_characters >= 200704
Unicode string literalsN2442GCC 4.5__cpp_unicode_literals >= 200710
Raw string literalsN2442GCC 4.5__cpp_raw_strings >= 200710
Universal character name literalsN2170GCC 4.5
User-defined literalsN2765GCC 4.7__cpp_user_defined_literals >= 200809
Standard 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 >= 200907
Explicit virtual overridesN2928 
N3206 
N3272
GCC 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
Concurrency
Sequence 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++14 지원은 아래와 버전들에서 지원되고 있습니다.



Language FeatureProposalAvailable in GCC?SD-6 Feature Test
Tweak to certain C++ contextual conversionsN33234.9
Binary literalsN34724.3 (GNU) 
4.9 (N3472)
__cpp_binary_literals >= 201304
Return type deduction for normal functionsN36384.8 (N3386) 
4.9 (N3638)
__cpp_decltype_auto >= 201304
Generalized lambda capture (init-capture)N36484.5 (partial) 
4.9 (N3648)
__cpp_init_captures >= 201304
Generic (polymorphic) lambda expressionsN36494.9__cpp_generic_lambdas >= 201304
Variable templatesN36515__cpp_variable_templates >= 201304
Relaxing requirements on constexpr functionsN36525__cpp_constexpr >= 201304
Member initializers and aggregatesN36535__cpp_aggregate_nsdmi >= 201304
Clarifying memory allocationN3664N/A
Sized deallocationN37785__cpp_sized_deallocation >= 201309
[[deprecated]] attributeN37604.9 (N3797)__has_cpp_attribute(deprecated) >= 201309
Single-quotation-mark as a digit separatorN37814.9 (N3797)__cpp_digit_separator >= 201309


+ Recent posts