gcc4.9.1新特性
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新特性的更多相关文章
- C++ 11学习和掌握 ——《深入理解C++ 11:C++11新特性解析和应用》读书笔记(一)
因为偶然的机会,在图书馆看到<深入理解C++ 11:C++11新特性解析和应用>这本书,大致扫下,受益匪浅,就果断借出来,对于其中的部分内容进行详读并亲自编程测试相关代码,也就有了整理写出 ...
- 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 · 引入访问方法的限 ...
- PHP5.3新特性
1.首先对之前滥用的语法进行了规范 众所周知PHP在语言开发过程中有一个很好的容错性,导致在数组或全局变量中包含字符串不使用引号是可以不报错的,很多业余的开发者因为懒惰而产生的安全问题十分严重,之所以 ...
- QT5.9 新特性与版本回顾
原文链接: http://blog.qt.io/blog/2017/05/31/qt-5-9-released 翻译内容如下,采用的是第三方某在线翻译软件,所以有些地方不是太精确,纵然大吉做了一定的调 ...
- Red Hat Enterprise Linux 7.x新特性
Red Hat Enterprise Linux 7.x新特性 RHEL7新特性简介 1. RHEL7目前支持架构 64-bit AMD.64-bit Intel.IBM POWER.IBM ...
- SQL Server 2014 新特性——内存数据库
SQL Server 2014 新特性——内存数据库 目录 SQL Server 2014 新特性——内存数据库 简介: 设计目的和原因: 专业名词 In-Memory OLTP不同之处 内存优化表 ...
- ElasticSearch 5学习(10)——结构化查询(包括新特性)
之前我们所有的查询都属于命令行查询,但是不利于复杂的查询,而且一般在项目开发中不使用命令行查询方式,只有在调试测试时使用简单命令行查询,但是,如果想要善用搜索,我们必须使用请求体查询(request ...
- [干货来袭]C#6.0新特性
微软昨天发布了新的VS 2015 ..随之而来的还有很多很多东西... .NET新版本 ASP.NET新版本...等等..太多..实在没消化.. 分享一下也是昨天发布的新的C#6.0的部分新特性吧.. ...
- CSS3新特性应用之结构与布局
一.自适应内部元素 利用width的新特性min-content实现 width新特性值介绍: fill-available,自动填充盒子模型中剩余的宽度,包含margin.padding.borde ...
随机推荐
- Monte Carlo simulated annealing
蒙特·卡罗分子模拟计算 使用蒙特·卡罗方法进行分子模拟计算是按照以下步骤进行的: 1. 使用随机数发生器产生一个随机的分子构型. 2. 对此分子构型的其中粒子坐标做无规则的改变,产生一个新的分子构型. ...
- 从Joda-Time反观Java语言利弊
基本上每个企业应用系统都涉及到时间处理.我们知道,以前用java原生的Date+Calendar非常的不方便.后来Joda-Time诞生,这个专门处理日期/时间的库提供了DateTime类型,用它可以 ...
- python IO 多路复用
一.epoll epoll 参考链接: https://www.cnblogs.com/Alanpy/articles/5125986.html epoll 参考链接: https://www.cn ...
- the network could not establish the connection
为了方便建表等操作,我用sql developer 连接linux 底下的数据库,可连接时出现了这个问题the network could not establish the connection. ...
- Navigation包中的move_base和amcl实现自动驾驶
安装功能包: 1.安装导航定位包navigation $ sudo apt-get install ros-indigo-navigation 2.由于导航包在/cmd_val下发布的移动数据加速度会 ...
- JS中几种常见的高阶函数
高阶函数:英文叫Higher-order function.JavaScript的函数其实都指向某个变量.既然变量可以指向函数,函数的参数能接收变量,那么一个函数就可以接收另一个函数作为参数,这种函数 ...
- Linux 查看系统负载
查看系统负 # 查看系统负载 命令:uptime :: up :, users, load average: 0.00, 0.00, 0.00 注:load average: 0.00, 0.00, ...
- react-router 4.0(二)传参
import React from 'react'; import ReactDOM from 'react-dom' import {Link,Route,HashRouter} from 'rea ...
- kindeditor4.1.11的使用方法
在引入某个外部框架/功能件的 时候, 通常是 先引入css, 后引入js. css的必要属性是rel和href, js的必要属性是charset和src. js都是用javascript的,所以 cs ...
- sqlserver数据库中sql的使用
目录: 1. 分组排序更新 2. 将查询结果插入到新的表中 3. 创建/更新存储过程 4. 创建/更新视图 5. 插入数据 6. 增加表格的列 7. 创建表格 8. 创建索引 9. 递归查询 1. 分 ...