Product News

IBM XL C/C++ 13.1 supports =default/=delete, constexpr, nullptr

XL C/C++ and AIX and Linux is now available:

XL C/C++ for AIX and Linux, V13.1 Now Released!

We're happy to announce the release of the XL C/C++ for AIX, V13.1 and XL C/C++ for Linux, V13.1 compilers!  The V13.1 release delivers POWER8 exploitation and new compiler and language features.

From the announcement details:

IBM® XL C/C++ for Linux™ is a standards-based, high performance C/C++ compiler with advanced optimizing features. XL C/C++ for Linux, V13.1 delivers a number of new features and enhancements:

  • Exploitation of the latest IBM POWER8™ architecture
  • Support for additional features in C11 and C++11, the current standards for the C and C++ programming languages
  • Partial support for the OpenMP 4.0 industry specification
  • Compile and runtime performance improvements
  • Additional performance options
  • New program diagnostics and error detection features

...

C++11 programming standard

C++11 is the latest standard for the C++ programming language, published as ISO/IEC 14882:2011. With V13.1, partial support for the C++11 standard continues with the implementation of the following features:

Defaulted and deleted functions

This feature introduces two new forms of function declarations to define explicitly defaulted functions and deleted functions. For the explicitly defaulted functions, the compiler generates the default implementations, which are more efficient than manually programmed implementations. The compiler disables the deleted functions to avoid calling unwanted functions.

You can use the -qlanglvl=defaultanddelete option to enable this feature.

Generalized constant expressions

The generalized constant expressions feature extends the set of expressions permitted within constant expressions. The implementation of this feature in XL C/C++ V12.1 was a partial implementation of what is defined in the C++11 standard. In this release, enhancements are made to support user-defined constexpr objects and constexpr pointers or references to constexpr functions and objects.

You can use the -qlanglvl=constexpr option to enable this feature.

The nullptr keyword

This feature introduces nullptr as a null pointer constant. The nullptr constant can be distinguished from integer 0 for overloaded functions. The constants of 0 and NULL are treated as the integer type for overloaded functions, whereas nullptr can be implicitly converted to only the pointer type, pointer-to-member type, and bool type.

You can use the -qlanglvl=nullptr option to enable this feature.

Qt 5.3 released

 

Qt 5.3 is now available.

Qt is the most widely-known and -used portable UI framework for C++. It offers native code performance and modern sophisticated user experiences across desktop, embedded, and mobile platforms. Both commercial and open source versions are available.

More details from the Qt 5.3 product page:

With Qt 5.3 a lot of effort was put into enhancing the overall quality and user experience across all the platforms. Qt 5.2 introduced a completely new dimension into cross-platform: the mobile platforms and it has been downloaded an amazing amount of more than 1 million times!

...

  • Added Qt Positioning API support for Android and iOS. Use the GPS directly from convenient Qt APIs!
  • Qt Bluetooth API has now support for Android as well
  • Printing support for Qt has been greatly enhanced
  • Qt 5.3 ships with Qt Creator 3.1, which also introduced a lot of enhancements and stability to existing features as well as an initial support for WinRT tooling, a new clang-based code model and improved Android tool chain integration.

libstudxml: A modern XML API for C++

libstudxml.PNGlibstudxml is an XML library for modern, standard C++. It has an API that I believe should have already been in Boost or even in the C++ standard library.

The API was first presented at the C++Now 2014 conference. Based on the positive feedback and encouragement I received during the talk, I've decided to make the implementation generally available.

As an example, we can parse this XML:

<person id="123">
  <name>John Doe</name>
  <age>23</age>
  <gender>male</gender>
</person>

With the following C++ code, which performs all the validation necessary for this XML vocabulary:

enum class gender {...};

ifstream ifs (argv[1]);
parser p (ifs, argv[1]);

p.next_expect (parser::start_element, "person", content::complex);

long id = p.attribute<long> ("id");

string n = p.element ("name");
short a = p.element<short> ("age");
gender g = p.element<gender> ("gender");

p.next_expect (parser::end_element); // person

The API has the following interesting features:

  • Streaming pull parser and streaming serializer
  • Two-level API: minimum overhead low-level & more convenient high-level
  • Content model-aware (empty, simple, complex, mixed)
  • Whitespace processing based on content model
  • Validation based on content model
  • Validation of missing/extra attributes
  • Validation of unexpected events (elements, etc)
  • Data extraction to value types
  • Attribute map with extended lifetime (high-level API)

libstudxml is compact, external dependency-free, and reasonably efficient. The XML parser is a conforming, non-validating XML 1.0 implementation that is based on tested and proven code. The library is released under the MIT license.

More information, documentation, and source code are available from libstudxml project page. Or, you can jump directly to the API description with examples.

just::thread C++11 and C++14 Thread Library V2.0 released

just::thread 2.0 is now available.

Anthony Williams' implementation of the C++11 and C++14 threading library adds support for gcc 4.8 and Microsoft Visual Studio 2013 and with a number of new features.

just::thread now includes:

  • The new std::shared_timed_mutex and std::shared_lock from C++14 allow for multiple readers to hold a shared lock on a mutex or one writer to hold an exclusive lock.

  • The extensions to the futures from the upcoming C++ Concurrency Technical Specification in the form of continuations. std::future<> and std::shared_future<> now have an additional member function "then()" which allows a further task to be scheduled when the future becomes "ready". This allows for improved support for asynchronous tasks.

  • jss::when_any and jss::when_all encapsulate a set of futures into a single future which becomes ready when either one or all of the provided futures becomes ready. This can be used with continuations to schedule asynchronous tasks to run when the prerequisites are ready.

  • A new lock wrapper jss::generic_lock_guard is provided. This is a concrete type rather than a template, and will lock any type of mutex which provides lock and unlock member functions.

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.