gcc4.9.1新特性-创新互联
10年积累的做网站、成都网站制作经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站设计后付款的网站建设流程,更有洛隆免费网站建设让你可以放心的选择与我们合作。>C family
Supportfor colorizing diagnostics emitted by GCC has been added. The -fdiagnostics-color=auto will enable it when outputting to terminals, -fdiagnostics-color=always unconditionally. The GCC_COLORS environment variable can be used to customize the colors or disable coloring. If GCC_COLORS variable is present in the environment, the default is -fdiagnostics-color=auto, otherwise -fdiagnostics-color=never.
Sample diagnostics output:
$ g++ -fdiagnostics-color=always -S -Wall test.C
test.C: In function ‘int foo()’:
test.C:1:14: warning: no return statement in function returning non-void [-Wreturn-type]
int foo () { }
^
test.C:2:46: error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum) instantiating ‘struct X<100>’
template struct X { static const int value = X::value; }; template struct X<1000>;
^
test.C:2:46: recursively required from ‘const int X<999>::value’
test.C:2:46: required from ‘const int X<1000>::value’
test.C:2:88: required from here
test.C:2:46: error: incomplete type ‘X<100>’ used in nested name specifier
With thenew #pragma GCC ivdep, the user can assert that there are no loop-carried dependencies which would prevent concurrent execution of consecutive iterations using SIMD (single instruction multiple data) instructions.
Supportfor Cilk Plus has been added and can be enabled with the -fcilkplus option. Cilk Plus is an extension to the C and C++ languages to support data and task parallelism. The present implementation follows ABI version 1.2; all features but _Cilk_for have been implemented.
C
ISO C11 atomics (the _Atomic type specifier and qualifier and the header) are now supported.
ISO C11 generic selections (_Generic keyword) are now supported.
ISO C11 thread-local storage (_Thread_local, similar to GNU C __thread) is now supported.
ISO C11 supportis now at a similar level of completeness to ISO C99 support: substantially complete modulo bugs, extended identifiers (supported except for corner cases when -fextended-identifiers is used), floating-point issues (mainly but not entirely relating to optional C99 features from Annexes F and G) and the optional Annexes K (Bounds-checking interfaces) and L (Analyzability).
Anew C extension __auto_type provides a subset of the functionality of C++11 auto in GNU C.
C++
The G++ implementation of C++1y return type deduction for normal functions has been updated to conform to N3638, the proposal accepted into the working paper. Most notably, it adds decltype(auto) for getting decltype semantics rather than the template argument deduction semantics of plain auto:
int& f();
auto i1= f(); // intdecltype(auto) i2 = f(); // int&G++ supports C++1y lambda capture initializers:
[x= 42]{ ... };
Actually, they have been accepted since GCC4.5, but now the compiler doesn't warn about them with -std=c++1y, and supports parenthesized and brace-enclosed initializers as well.G++ supports C++1y variable length arrays. G++ has supported GNU/C99-style VLAs for a long time, but now additionally supports initializers and lambda capture by reference. In C++1y mode G++ will complain about VLA uses that are not permitted by the draft standard, such as forming a pointer to VLA type or applying sizeof to a VLA variable. Note that it now appears that VLAs will not be part of C++14, but will be part of a separate document and then perhaps C++17.
void f(int n) {
int a[n] = { 1, 2, 3 }; // throws std::bad_array_length if n < 3 [&a]{ for (int i : a) { cout << i << endl; } }();
&a; // error, taking address of VLA}
G++ supports the C++1y [[deprecated]] attribute modulo bugs in the underlying [[gnu::deprecated]] attribute. Classes and functions can be marked deprecated and a diagnostic message added:
class A;
int bar(int n);
#if __cplusplus > 201103
class [[deprecated("A is deprecated in C++14; Use B instead")]] A;
[[deprecated("bar is unsafe; use foo() instead")]]
int bar(int n);
int foo(int n);
class B;
#endif
A aa;// warning: 'A' is deprecated : A is deprecated in C++14; Use B insteadint j = bar(2); // warning: 'int bar(int)' is deprecated : bar is unsafe; use foo() insteadG++ supports C++1y digit separators. Long numeric literals can be subdivided with a single quote ' to enhance readability:int i = 1048576;
int j = 1'048'576;
int k = 0x10'0000;int m = 0'004'000'000;int n = 0b0001'0000'0000'0000'0000'0000;double x = 1.602'176'565e-19;
double y = 1.602'176'565e-1'9;G++ supports C++1y generic (polymorphic) lambdas.
// a functional object that will increment any typeauto incr = [](auto x) { return x++; };
As a GNU extension, G++ supports explicit template parameter syntax for generic lambdas. This can be combined in the expected way with the standard auto syntax.
// a functional object that will add two like-type objectsauto add = [] (T a, T b) { return a + b; };
G++ supports unconstrained generic functions as specified by §4.1.2 and §5.1.1 of N3889: Concepts Lite Specification. Briefly, auto may be used as a type-specifier in a parameter declaration of any function declarator in order to introduce an implicit function template parameter, akin to generic lambdas.
// the following two function declarations are equivalentauto incr(auto x) { return x++; }
template
auto incr(T x) {return x++; }
Runtime Library (libstdc++)
Improved supportfor C++11, including:
supportfor ;
The associative containersin
网站名称:gcc4.9.1新特性-创新互联
标题网址:http://pwwzsj.com/article/dgojop.html