📜 ⬆️ ⬇️

GCC-4.7 release

Tonight, the long-awaited GCC 4.7, the release of which is dedicated to the 25th anniversary of the project, was released tonight.

This release is long-awaited first of all for C ++ programmers, as it brings with it extensive support for the new C ++ 11 standard.

The most notable innovations:

Extended syntax friend:
template<class W> class Q { static const int I = 2; public: friend W; }; struct B { int ar[Q<B>::I]; }; 

')
Final and override keywords
 struct B { virtual void f() const final; virtual void f(int); }; struct D : B { void f() const; // error: D::f attempts to override final B::f void f(long) override; // error: doesn't override anything void f(int) override; // ok }; struct E final { }; struct F: E { }; // error: deriving from final class 


Initialization of non-static members.
 struct A { int i = 42; } a; // initializes ai to 42 


Custom literals
 constexpr long double operator"" _degrees (long double d) { return d * 0.0175; } long double pi = 180.0_degrees; 


Alias-declarations. (I do not know how to translate into Russian)
Extended typedef for templates. Thanks kharvd for clarifying.
 template <class T> using Ptr = T*; Ptr<int> ip; // decltype(ip) is int* 


Delegation of designers (Hooray, hurray, the most delicious!)
 struct A { A(int); A(): A(42) { } // delegate to the A(int) constructor }; 


A also significant improvement in the standard library support for C ++ 11.

The remaining changes and more information on the release can be found here.

UPD: 03/24/2012 There was a build in the sid Debian branch.

Source: https://habr.com/ru/post/140557/


All Articles