C family

Support for 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::: warning: no return statement in function returning non-void [-Wreturn-type]
int foo () { }
^
test.C::: error: template instantiation depth exceeds maximum of (use -ftemplate-depth= to increase the maximum) instantiating ‘struct X<>’
template <int N> struct X { static const int value = X<N->::value; }; template struct X<>;
^
test.C::: recursively required from ‘const int X<>::value’
test.C::: required from ‘const int X<>::value’
test.C::: required from here test.C::: error: incomplete type ‘X<>’ used in nested name specifier With the new #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.
Support for 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 <stdatomic.h> 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 support is 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).
A new C extension __auto_type provides a subset of the functionality of C++ 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(); // int
decltype(auto) i2 = f(); // int&
G++ supports C++1y lambda capture initializers:
[x = ]{ ... };
Actually, they have been accepted since GCC 4.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++, but will be part of a separate document and then perhaps C++.
void f(int n) {
int a[n] = { , , }; // 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 instead
int j = bar(); // warning: 'int bar(int)' is deprecated : bar is unsafe; use foo() instead
G++ supports C++1y digit separators. Long numeric literals can be subdivided with a single quote ' to enhance readability:
int i = ;
int j = '';
int k = 0x10'0000;
int m = '''000;
int n = 0b0001'''''0000; double x = 1.602''565e-;
double y = 1.602''565e-'9;
G++ supports C++1y generic (polymorphic) lambdas.
// a functional object that will increment any type
auto 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 objects
auto add = [] <typename T> (T a, T b) { return a + b; };
G++ supports unconstrained generic functions as specified by §4.1. and §5.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 equivalent
auto incr(auto x) { return x++; }
template <typename T>
auto incr(T x) { return x++; }
Runtime Library (libstdc++) Improved support for C++, including:
support for <regex>;
The associative containers in <map> and <set> and the unordered associative containers in <unordered_map> and <unordered_set> meet the allocator-aware container requirements;
Improved experimental support for the upcoming ISO C++ standard, C++, including:
fixing constexpr member functions without const;
implementation of the std::exchange() utility function;
addressing tuples by type;
implemention of std::make_unique;
implemention of std::shared_lock;
making std::result_of SFINAE-friendly;
adding operator() to integral_constant;
adding user-defined literals for standard library types std::basic_string, std::chrono::duration, and std::complex;
adding two range overloads to non-modifying sequence oprations std::equal and std::mismatch;
adding IO manipulators for quoted strings;
adding constexpr members to <utility>, <complex>, <chrono>, and some containers;
adding compile-time std::integer_sequence;
adding cleaner transformation traits;
making <functional>s operator functors easier to use and more generic;
An implementation of std::experimental::optional.
An implementation of std::experimental::string_view.
The non-standard function std::copy_exception has been deprecated and will be removed in a future version. std::make_exception_ptr should be used instead.

gcc4.9.1新特性的更多相关文章

  1. C++ 11学习和掌握 ——《深入理解C++ 11:C++11新特性解析和应用》读书笔记(一)

    因为偶然的机会,在图书馆看到<深入理解C++ 11:C++11新特性解析和应用>这本书,大致扫下,受益匪浅,就果断借出来,对于其中的部分内容进行详读并亲自编程测试相关代码,也就有了整理写出 ...

  2. paip.php 5.0 5.3 5.4 5.5 -6.0的新特性总结与比较

    paip.php 5.0 5.3 5.4  5.5 -6.0的新特性总结与比较 PHP5的新特性 2 · 对象的参照过渡是默认的(default) 3 · 引入访问属性的限制 3 · 引入访问方法的限 ...

  3. PHP5.3新特性

    1.首先对之前滥用的语法进行了规范 众所周知PHP在语言开发过程中有一个很好的容错性,导致在数组或全局变量中包含字符串不使用引号是可以不报错的,很多业余的开发者因为懒惰而产生的安全问题十分严重,之所以 ...

  4. QT5.9 新特性与版本回顾

    原文链接: http://blog.qt.io/blog/2017/05/31/qt-5-9-released 翻译内容如下,采用的是第三方某在线翻译软件,所以有些地方不是太精确,纵然大吉做了一定的调 ...

  5. Red Hat Enterprise Linux 7.x新特性

    Red Hat Enterprise Linux 7.x新特性 RHEL7新特性简介 1.      RHEL7目前支持架构 64-bit AMD.64-bit Intel.IBM POWER.IBM ...

  6. SQL Server 2014 新特性——内存数据库

    SQL Server 2014 新特性——内存数据库 目录 SQL Server 2014 新特性——内存数据库 简介: 设计目的和原因: 专业名词 In-Memory OLTP不同之处 内存优化表 ...

  7. ElasticSearch 5学习(10)——结构化查询(包括新特性)

    之前我们所有的查询都属于命令行查询,但是不利于复杂的查询,而且一般在项目开发中不使用命令行查询方式,只有在调试测试时使用简单命令行查询,但是,如果想要善用搜索,我们必须使用请求体查询(request ...

  8. [干货来袭]C#6.0新特性

    微软昨天发布了新的VS 2015 ..随之而来的还有很多很多东西... .NET新版本 ASP.NET新版本...等等..太多..实在没消化.. 分享一下也是昨天发布的新的C#6.0的部分新特性吧.. ...

  9. CSS3新特性应用之结构与布局

    一.自适应内部元素 利用width的新特性min-content实现 width新特性值介绍: fill-available,自动填充盒子模型中剩余的宽度,包含margin.padding.borde ...

随机推荐

  1. 图片居中table-cell

  2. 家庭记账本之微信小程序(五)

    wxml的学习 WXML(WeiXin Markup Language)是框架设计的一套标签语言,结合基础组件.事件系统,可以构建出页面的结构. 用以下一些简单的例子来看看WXML具有什么能力: 数据 ...

  3. 关于Oracle 10.2.0.5 版本应用SCN补丁14121009相关问题

    环境:OEL 5.7 + Oracle 10.2.0.5 背景:Oracle发布的两篇关于2019年6月份将自动调整高版本数据库的SCN COMPATIBILITY的MOS文章引起了很多客户的恐慌,尤 ...

  4. Streaming从Spark2X迁移到Spark1.5 summary

    配置文件的加载是一个难点,在local模式下非常容易,但是submit后一直报找不到文件,后来采用将properties文件放在加载类同一个package下,打包到同一个jar中解决. import ...

  5. oracle导出导入指定表

    从源数据库导出: exp user1/pwd@server1/orcl file=c:\temp\exp.dmp tables=(table1, table2) 导入到目标数据库: imp user2 ...

  6. KNN算法 - 数据挖掘算法(3)

    (2017-04-10 银河统计) KNN算法即K Nearest Neighbor算法.这个算法是机器学习里面一个比较经典的.相对比较容易理解的算法.其中的K表示最接近自己的K个数据样本.KNN算法 ...

  7. BIOS备忘录之x86硬件编程(寄存器与IO)

    SOC固件(BIOS)开发: 1.熟悉硬件原理图:要弄清楚pin脚的功能: 2.配置GPIO引脚,配置成Native功能还是GPIO功能(如果是配置成GPIO,需要在code里面显式的使用): 3.硬 ...

  8. QQ"坦白说"抓包破解与PacketCapture使用介绍

    据腾讯发布内容来看,“坦白说”是刚刚在QQ中上线的新功能,还在测试阶段就已经非常火爆. 但作为一种web端的小游戏,无疑可以使用爬虫的来自我模拟. (话说写完这篇的时候我总感觉自己几年前好像写过这个. ...

  9. linux基础之grep

    grep: Global search REgular expression and Print out the line 作用: 文本搜索工具,根据用户指定的模式对目标文本逐行进行匹配检查,打印匹配 ...

  10. BZOJ 2759 一个动态树好题(动态树)

    题意 https://www.lydsy.com/JudgeOnline/problem.php?id=2759 思路 每个节点仅有一条有向出边, 这便是一棵基环内向树,我们可以把它在 \(\text ...