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 ...
随机推荐
- 自动化安装-【kickstart】
批量自动安装软件介绍 kickstart 是一种无人值守的安装方式,工作原理是在安装过程中记录人工干预填写的各种参数,并生成以个名为ks.cfg(自动应答文件)的文件,如果在自动安装过程中出现要填写参 ...
- React时间组件(时分秒补0)页面全局引用
1.common.js export function formatTime(data){ var d = new Date(data); function doTime(d){ if(d<10 ...
- C#:进程
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using S ...
- python_WSGI接口
WSGI:Web Server Gateway Interface WSGI接口定义非常简单,它只要求Web开发者实现一个函数,就可以响应HTTP请求.我们来看一个最简单的Web版本的“Hello, ...
- Go 初体验 - 令人惊叹的语法 - defer.3 - defer 函数参数计算时机
defer 函数的参数计算时机 定义一个 defer 函数,接收参数 n: 调用: 输出: 有点惊讶,为什么不是 100 200 200? go 语言里,defer 函数的参数是在定义位置被计算的,也 ...
- 杂谈迁移tomcat项目到docker,以及遇到的问题
1.迁移tomcat项目异常简单,下一个tomcat的container,然后直接把webapps放进去就行了. #tomcat版本随原始项目版本而变,具体版本列表查看:https://hub.doc ...
- qemu 对虚机的地址空间管理
转载:http://huchh.com/2015/06/22/qemu-%E5%AF%B9%E8%99%9A%E6%9C%BA%E7%9A%84%E7%BA%BF%E6%80%A7%E5%9C%B0% ...
- C++的重载操作符(operator)介绍(转)
本文主要介绍C++中的重载操作符(operator)的相关知识. 1. 概述 1.1 what operator 是C++的一个关键字,它和运算符(如=)一起使用,表示一个运算符重载函数,在理解时可将 ...
- Python Redis hash
hash表现形式上有些像pyhton中的dict,可以存储一组关联性较强的数据 , redis中Hash在内存中的存储格式如下图: hset(name, key, value) # name对应的ha ...
- 【题解】JSOIWC2019 Round 5
题面: 题解: T1: 算法1: 枚举每个灯塔的方向,并分别判断是否有解.时间复杂度O(K*4^K). 预计得分:50-70分 算法2: 不难发现,当k≥4的时候一定有解,将最靠左的两个下面的朝右上. ...