March 2013

New paper: N3532, C++ Dynamic Arrays -- Lawrence Crowl and Matt Austern

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3532

Date: 2013-03-12

C++ Dynamic Arrays

by Lawrence Crowl and Matt Austern

Excerpt:

Instead of adopting C variable-length arrays, we propose to define a new facility for arrays where the number of elements is bound at construction. We call these dynamic arrays, dynarray. In keeping with C++ practice, we wish to make dynarrays usable with more than just automatic variables. But to take advantage of the efficiency stack allocation, we wish to make dynarray optimizable when used as an automatic variable.

New paper: N3527, optional -- Fernando Cacciola and Andrzej KrzemieĊ„ski

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3527

Date: 2013-03-10

A proposal to add a utility class to represent optional objects (Revision 3)

by Fernando Cacciola and Andrzej Krzemieński

Excerpt:

Class template optional<T> proposed here is a type that may or may not store a value of type T in its storage space. Its interface allows to query if a value of type T is currently stored, and if so, to access it. The interface is based on Fernando Cacciola's Boost.Optional library, shipping since March, 2003, and widely used. It requires no changes to core language, and breaks no existing code.

New paper: N3544, SG5 Transactional Memory Meeting Minutes, 2013-02-25 - 2013-03-04 -- Michael Wong

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing.

If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3544

Date: 2013-03-06

SG5: Transactional Memory (TM) Meeting Minutes 2013/02/25-2013/03/04

by Michael Wong

Excerpt:

Contents

Minutes for 2013/02/25 SG5 Conference Call ... 2

Minutes for 2013/03/04 SG5 Conference Call ... 9

C++11 Compiler Support Shootout -- Alex Korban

C++11 compiler support continues to grow across the industry, with leaders and laggards still all moving in the C++11 direction.

C++11 Compiler Support Shootout: Visual Studio, GCC, Clang, Intel

by Alex Korban

It’s been more than half a year since my last comparison of the C++11 support across different compilers. This time I’d like to see how different compilers stack up based on the documentation for the pre-release versions of these compilers.

The next release of GCC is 4.8 and the upcoming version of Clang is 3.3. If you use Visual Studio 2012, you can install an experimental CTP update released in November 2012 to get additional C++11 features.

...

Why is noexcept checked dynamically? -- StackOverflow

Quick A: Because exceptions occur (or not) dynamically.

Why is C++0x's noexcept checked dynamically?

I am curious about the rationale behind noexcept in the C++0x FCD. throw(X) was [deprecated], but noexcept seems to do the same thing. Is there a reason that noexcept isn't checked at compile time? It seems that it would be better if these functions were checked statically that they only dcalled throwing functions within a try block.

What's the difference between push_back vs emplace_back? -- StackOverflow

Quick A: When correctly implemented per the standard, you get in-place construction with perfect forwarding.

Longer question:

push_back vs emplace_back

I'm a bit confused regarding the difference between push_back and emplace_back.

 

void emplace_back(Type&& _Val);
void push_back(const Type& _Val);
void push_back(Type&& _Val);

As there is a push_back overload taking a rvalue reference I don't quite see what the purpose of emplace_back becomes?

AESOP: Auto-parallelizing LLVM

An interesting development. Note that this is a research project, not a commercial product.

AESOP

The autoparallelizing compiler for shared-memory computers

AESOP is a high-performance, open-source compiler developed as LLVM plugins at the University of Maryland. Unlike many research compilers, AESOP is designed to handle real-world code rather than small, simple kernels. For example, AESOP can compile SPEC2006 and OMP2001 benchmarks, and our automated test suite consists of over 2 million lines of code. Still, we warn that AESOP is still just a 2-person research project, and we do not claim it to be production-ready.

 

By leveraging existing LLVM frontends and performing its analysis and transformations at the bytecode level, AESOP can serve as a drop-in replacement for clang, gcc, g++ and gfortran.

AESOP is free software, primarily tested targeting 32-bit x86 Linux. However, parts of it are likely to work wherever LLVM works.

 

Note: We're currently working on a whitepaper-style technical report on AESOP, which we plan to make available in April 2013.

Runtime-Compiled C++ -- "Edit and Continue"++ for MS VC++, gcc, Clang/LLVM

Very cool work:

Runtime-Complied C++ blog

This technique allows you to change your C++ code while it's running.

It uses no scripting, no VM, no external tools -- you can apply it to your own code and you can continue to use your favourite IDE. We think the quit-recompile-restart-reload cycle we're all used to could soon be a thing of the past.

If this is your first visit, watch the teaser video on the left.

If you want to know more, start here

dougbinks writes on the Reddit comment thread:

Compiling and loading code at runtime certainly isn't new, but what we're trying to do is develop a permissive open source portable and standard C++ solution which makes it easy to use. Cling is another similar project, but it uses compiler changes to LLVM so you need to use that compiler, whereas our solution requires only small changes to get it working with any compiler (currently supporting Visual Studio, gcc, clang/llvm).

What does std::function do that function pointers don't? -- StackOverflow

Quick A: A lot. They can bind to anything callable, not just functions. And they can perform conversions on parameter and return types.

Is there a use case for std::function that is not covered by function pointers, or is it just syntactic sugar?

The notation for std::function is quite nice when compared to function pointers. However, other than that, I can't find a use case where it couldn't be replaced by pointers. So is it just syntactic sugar for function pointers?