Product News

GCC 4.9.0 released, full of improved C++11 and C++14 features

GCC 4.9.0 is now available, with further improved C++11 and C++14 conformance.

GCC 4.9.0 Released

by Jakub Jelinek

From the announcement:

Support for various C++14 additions have been added to the C++ Front End, on the standard C++ library side the most important addition is support for the C++11 <regex>. ...

Various kinds of undefined behaviors in programs can be now diagnosed at runtime through Undefined Behavior Sanitizer. ...

See http://gcc.gnu.org/gcc-4.9/changes.html for more information about changes in GCC 4.9.

From the Changes page:

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 = 42]{ ... };
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++14, but will be part of a separate document and then perhaps C++17.
void f(int n) {
  int a[n] = { 1, 2, 3 }; // 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(2); // 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 = 1048576;
int j = 1'048'576;
int k =0x10'0000;
int m = 0'004'000'000;
int n = 0b0001'0000'0000'0000'0000'0000;
double x = 1.602'176'565e-19;
double y = 1.602'176'565e-1'9;
G++ supports C++1y polymorphic lambdas.
// a functional object that will increment any type
auto incr = [](auto x) { return x++; };

Runtime Library (libstdc++)

Improved support for C++11, 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++14, 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.

Parallel STL: Democratizing Parallelism in C++ -- Artur Laksberg

Today on VCblog:

Parallel STL: Democratizing Parallelism in C++

by Artur Laksberg

From the article:

Over the last few years, a group of software engineers from Intel, Microsoft and NVidia have worked together on a proposal for the ISO C++ Standard known as the "Parallel STL".

This proposal builds on the experience of these three companies building parallel libraries for their platforms -- the Threading Building Blocks (Intel), PPL and C++ AMP (Microsoft) and Thrust (NVidia). All these libraries have a common trait -- they allow developers to perform common parallel operations on generic containers. Naturally, this aligns very well with the goals of the C++ Standard Template Library.

All three companies are working on their implementations of the proposal. Today, we're pleased to announce that Microsoft has made the prototype of the proposal available as an open source project at ParallelSTL.codeplex.com.

We encourage everyone to head over to our CodePlex site and check it out. The proposal has been approved to be the foundation for the "Parallelism Technical Specification" by the ISO C++ Standards Committee ...

cereal 1.0.0 is available

cereal 1.0 is available:

cereal - A C++11 library for serialization

cereal is a header-only C++11 serialization library. cereal takes arbitrary data types and reversibly turns them into different representations, such as compact binary encodings, XML, or JSON. cereal was designed to be fast, light-weight, and easy to extend -- it has no external dependencies and can be easily bundled with other code or used standalone.

... cereal uses features new to C++11 and requires a fairly compliant C++ compiler to work properly. cereal has been confirmed to work on g++ 4.7.3, clang++ 3.3, and MSVC 2013 (or newer). It may work on older versions, but there is no emphasis on supporting them. cereal works under both libstdc++ and libc++ when compiling with g++ or clang++.

CppDepend 4 Released

cppdepend-features.PNGCppDepend allows architects and developers to analyze a code base, automate code reviews, and facilitate refactoring and migration. It’s based on Clang for more reliability and lets queries the code base over LINQ queries thanks to CQLinq.

New features in CppDepend v4.0 include:

  • A new dashboard panel that shows the state of the current code base at a glance as well as a comparison to a baseline.
  • Monitoring trends on 50 default “Trend Metrics” as well as custom trend metrics. These can be displayed through Trend Charts.
  • Focus on recent rules violations (by using filters) that occur on code elements added or re-factored since a baseline.
  • Listing rules and queries according to common criteria, and quickly listing all violated rules.
  • Major UI enhancements and modernized menu organization.
  • Enhanced and redesigned reports include trend metrics charts and more information.

Open Source licenses are available free to non-commercial open source software development projects. For more details, please see the Open Source project license terms.

Oracle Studio 12.4 Beta release with C++11

The Oracle Solaris Studio 12.4 Beta is now released and available for download.

Supported platforms:

  • Solaris 10u10 and Solaris 11 on SPARC and x86
  • Oracle and Red Hat Linux 5.8 through 5.10
  • Oracle and Red Hat Linux 6 through 6.5

This release features:

  • New C++ compiler and dbx debugger that support the C++ 2011 language standard
  • A completely redesigned Performance Analyzer UI that simplifies identification of key performance issues, plus remote data analysis, cross-architecture support, comparison of results, and improved kernel profiling
  • Code Analyzer for improving your application with static source-code checking, run-time memory access checking (including memory leaks), and identification of un-exercised code.  Graphical user interface and command-line provide robust interfaces for reviewing results and historical analysis of data
  • Compiler and library optimizations for Oracle's SPARC T5, M5, M6, Fujitsu's M10, and Intel's Ivy Bridge servers
  • Support for new OpenMP 4.0 standard including Region Cancellation, Thread Affinity, Tasking Extensions and Sequentially Consistent Atomics
  • Integrated Development Environment (IDE) that includes C++ 2011 support, improved response time, and a smaller memory footprint to efficiently handle very large source repositories.

For a complete listing of the new and enhanced features in this release, see the Oracle Solaris Studio 12.4 What's New.

HPX version 0.9.8 released -- STE||AR Group

The STE||AR Group has released V0.9.8 of HPX -- A general purpose parallel C++ runtime system for applications of any scale.

HPX V0.9.8 Released

The newest version of HPX (V0.9.8) is now available for download! Please see here for the release notes.

HPX now exposes an API fully conforming to the concurrency related parts of the C++11 and the draft C++14 standards, extended and applied to distributed computing.

From the announcement:

  • A large part of the code base of HPX has been refactored and partially re-implemented: the threading and networking subsystems have been improved in performance, modularity, and robustness, the API was improved for closer conformance to the concurrency related parts of the C++11 and C++14 draft standards and the upcomming Concurrency TS.
  • We added new API functionality like hpx::migrate and hpx::copy_component which are the basic building blocks necessary for implementing higher level abstractions for system-wide load balancing, runtime-adaptive resource management, and object-oriented check-pointing and state-management.
  • We improved the distributed reference counting scheme used by HPX which helps managing distributed objects and memory.

Announcing the C++ FAQ

In addition to CppCon announced earlier this week, today the Standard C++ Foundation is pleased to announce a new unified C++ FAQ. The following introduction was written by Herb Sutter.

 

For the past 18 months, a small group of us led by Marshall Cline and myself have been hard at work on making a unified C++ FAQ available here at isocpp.org, as a wiki whose editing can be crowdsourced to keep it up-to-date with current information about modern C++.

The unified modern C++ FAQ is now ready to launch, and you can find the current content here:

C++ FAQ

The following is some background information about this project.

History and Goals

Until now, there have been several different overlapping FAQs, including notably:

  • Bjarne Stroustrup’s FAQ pages
  • Marshall Cline’s popular C++ FAQs Online
  • at least three different StackOverflow C++ FAQs in some form, last time I looked
  • and many others

However, in practice we noticed several difficulties with this status quo:

  1. Fragmentation: The existing FAQs are fragmented, so people often have to consult several of them in order to find a single answer. On the other hand, they frequently also overlap in their contents, which creates redundancy and sometimes inconsistent treatments of the same question.
  2. Staying up to date: They all (even Bjarne’s) contained some out-of-date material, because it’s just hard work for a single author or small group to maintain a good and always-updated FAQ.
  3. Legacy search rank: When people search for information about C++, search engines often lead to pages that are highly ranked because they are well established -- they have been available for a long time and are widely linked-to. But since C++11 in particular has changed modern C++ style and recommendations, much of this popular information has now become dated or incomplete.

To improve this, here are the following major goals of the new FAQ and how we are achieving them:

  1. Solve the fragmentation problem: Provide a unified merged FAQ, starting as a union of Marshall’s and Bjarne’s FAQs. Marshall and Bjarne (and Addison-Wesley) have graciously agreed to provide their FAQ contents as seed material to be the initial content of the FAQ. Marshall Cline has worked hard to import his FAQ into the new FAQ via his automated tools, and I have recently completed hand-editing over 50,000 words of Bjarne’s FAQ into the new FAQ wiki structure.
  2. Solve the up-to-dateness problem: Provide wiki-based crowdsourced editing and maintenance. Any qualified C++ expert can and should be able to add to and improve the FAQ -- including all committee members and the scores (possibly hundreds) of regular high-quality contributors on StackOverflow and other sites. Marshall Cline in particular has worked tirelessly for the past year to produce a robust wiki-based mechanism with good collision detection and resolution. (Note: Much of the imported FAQ information has already been updated, but much still needs to be done -- you can help by using the "recommend an improvement" on any FAQ title to let us know. More on that feature below.)
  3. Solve the legacy websearch problem: When people search for C++ information, they should quickly get to the latest isocpp.org FAQ. This will be simple thanks to Marshall’s and Bjarne’s cooperation: Currently much of the websearch traffic goes to their FAQs because of their long history and pagerank. Both Marshall and Bjarne will be updating their FAQs to either forward or link to the new FAQ on a per-FAQ level. (To enable this, we have maintained the internal FAQ tags Marshall was already using, and I kept a careful index mapping from Bjarne’s FAQ pages#tags to the new tags so that he can easily provide redirects.) This way, the isocpp.org FAQ should quickly become the de facto top search result for C++ FAQs and other C++ information.

cpp-faq-example.PNG

We’re also trying to provide additional features:

  • Provide new FAQ sections for community information. This includes things like "User Groups Worldwide" and "Partial List of ISO C++ Committee Members" FAQ sections.
  • Provide new FAQ sections for "What's new in C++11" and "... in C++14." This makes it easier to see "What's different if I already know [a certain previous standard supported by my compiler]."
  • Provide new FAQ sections for "C++ for {C#/Java | Objective-C | C | C++98 } developers." Some of these have already been created with seed content, but need more information from experts in those areas. We hope crowdsourcing will fill this gap relatively quickly; one new FAQ per contributor scales really well with lots of contributors while being a light load for everyone.
  • Provide a new FAQ section for "C++ Myths and Urban Legends." This will help socialize correct information by providing answers to common objections and misconceptions. C++ isn’t perfect and shouldn’t be presented that way, but it’s not nearly as imperfect as frequent incorrect claims would make it out to be. Misinformation helps no one, and we can deal with common misunderstandings here. Again, this currently contains some seed content; more to come.
  • Provide a way to subscribe to the latest/freshest information: RSS feed for FAQ changes. We've created an RSS feed for FAQ change diffs (link also available in left sidebar while in the FAQ) so that anyone can subscribe to a stream of diffs of current changes as they happen, including new FAQs and updates to existing FAQs. In the past, updates to the preexisting FAQs were often buried and undiscoverable, making them less useful than they could be. This way, people who care can easily be informed about new material, and suggest further edits.
    cpp-faq-recommend.png
  • Provide a way for anyone, not just FAQ editors, to suggest improvements. If you hover over any FAQ's title bar, you will see not only a permalink icon, but also an icon where you can "recommend an improvement to this FAQ" including to suggest new FAQs not yet in the list.
  • Provide a "moderated/curated" experience by having designated FAQ editors, but allow lots of people to become FAQ editors. Today there are already over 50 FAQ editors. If you offer good suggestions via the public "recommend an improvement" links, it probably won't be long before you start seeing Edit links appear when you visit the FAQ pages.
  • Provide a FAQ Discussion forum. For those interested in minutiae or sending suggestions directly to FAQ editors, you can subscribe to the faq-discussion forum, also available by email at [email protected] (email [email protected] to subscribe by email).

Acknowledgments

Our huge thanks go out to Marshall Cline who has put in a vast amount of volunteer work to make this possible, and also to Bjarne Stroustrup, Eric Niebler, Marshall Clow, Peter Gordon, Pearson/Addison-Wesley and the many other FAQ editors who have already made improvements -- all of these people have already contributed a lot of work and help to this. Thank you! And thanks again to everyone who has worked hard to make this possible.

Herb

 

NT² 3.0 and Boost.SIMD -- Stable release

TThe first stable release of the 3.x series of MetaScale’s open-source software is available: NT² 3.0. It also includes its spin-off project, Boost.SIMD (not yet a Boost library). Many Issues have been closed since last beta. The main focus of this release cycle was to fix performances issues and to stabilize some parts of the API.

NT² 3.0 Release Announcement

Source and binary packages can be downloaded here

Full changelog is available here