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 ...
随机推荐
- Java 基础 IO流
一,前言 在前面的学习过程中,我们一直都是在操作文件或者文件夹,并没有给文件中写任何数据.现在我们就要开始给文件中写数据,或者读取文件中的数据. 二,字节流 2.1 字节输出流 OutputStrea ...
- Domain Driven Development相关概念
Entity 与 Value Object1,Entity有唯一的身份标识,是可变的对象.Value Object是immutable,创建了就不能改变.2,Value Object可以在多个领域之间 ...
- Parco_Love_gcd
传送门 出题人说正解为RMQ,鄙人实在太蒟蒻了,不会呀只能暴力…… #include <bits/stdc++.h> using namespace std; #define ll lon ...
- 原生js阻止表单跳转
/* W3C浏览器下的 */ var forms = document.getElementById("from") forms.addEventListener('submit' ...
- autoMapper的介绍
.NET的DTO映射工具AutoMapper 分类: 多层架构 DTO .NET2012-08-11 10:27 2466人阅读 评论(0) 收藏 举报 原文:https://github.com/A ...
- python_的面向对象编程
废话不多说,先弄个对象来看看 class Student(object): def __init__(self, name, score): self.name = name self.score = ...
- Unity骨骼动画资源解析与优化
一,背景 最近发现项目的动画文件有点大,不光内存大,而且文件也很大,所以从这2个方面下手处理 二,动画文件大小优化 为了优化动画文件大小,我们可以先分析下文件,Ctrl+D将动画文件从FBX拷贝出来, ...
- Java代码质量改进之:同步对象的选择
在Java中,让线程同步的一种方式是使用synchronized关键字,它可以被用来修饰一段代码块,如下: synchronized(被锁的同步对象) { // 代码块:业务代码 } 当synchro ...
- 利用“Java同包同名类执行顺序”取消Java 网站应用程序Licence验证
如果是在tomcat里运行,lib目录下一大堆的JAR包,不同的JAR包里可能会有相同的包名类名,JRE按照JAR名字的字母顺序加载JAR文件,同名类如果已加载,则后面的同名类会忽略. 公司购买的一款 ...
- activiti5/6 系列之--Activiti与BPMN2.0规范相关节点对应关系
根据BPMN2.0规范的分类划分为以下部分: 1.启动与结束事件(event) 2.顺序流(Sequence Flow) 3.任务(Task) 4.网关(Gateway) 5.子流程(Subproce ...