November 2015

ACCU 2016 call for papers: closes 13th Nov

A reminder that the ACCU 2016 conference call for papers closes on Fri 13th Nov. The conference dates are 19th- 23rd April 2016 and the venue will again be Bristol, England.

ACCU 2016 call for papers

About the conference:

ACCU has a strong C++ track, though it is not a C++-only conference. If you have something to share, check out the call for papers on the ACCU website:

Cheerp 1.1 - C++ for the Web with fast startup times, dynamic memory and more speed!--Leaning Tech

If you want your C++ code to run on the web, there is Emscripten, but there is also Cheerp:

Cheerp 1.1 - C++ for the Web with fast startup times, dynamic memory and now, more speed!

by Leaning Technologies Ltd.

From the article:

Cheerp is a C++ compiler for the Web platform. Roughly a year ago we released Cheerp 1.0 with the promise of making C++ a first class language for the Web, with full access to DOM and HTML5 APIs (including WebGL) and great performance. At that time, we could only partially meet that promise.

With our early adopters starting to use Cheerp on real world, large scale applications, we were proud to see that Cheerp could indeed be used to seamlessly integrate C++ code into HTML5 apps. But we also realized that the performance of the compiled code was disappointing on real codebases.

As an example, our first benchmarking result on our first large-scale (~1M sloc) customer code was around forty times (40x) slower than native. Not only was this result disappointing, but it also was much worse than what we were expecting based on our internal benchmarks.

One year later, after significant effort focused on performance optimizations, we are here today to announce Cheerp 1.1...

The Variant Saga: A happy ending?

Variant is like a union, only it tells you what it currently contains, and it will barf if you try to get something out of it that is does not currently contain. It's the type safe sibling of the union:

variant<double, string> v = 42.;
double d = get<double>(v);

I had proposed a variant many moons ago (N4218). After many discussions it seemed that the committee cannot agree on what the ideal C++ variant would look like. I will resolve this cliffhanger -- but before doing that let me introduce you to some of the key discussion points.

An ideal variant will always contain one of its alternative types. But look at this code snippet:

variant<string, MyClass> v = "ABC";
v = MyClass();

The second line will destroy the old value contained in the variant and construct the new value of a different type. Now suppose that the MyClass construction threw: what will the variant contain? What happens when you call get<1>(v)? What happens when the variant gets destroyed?

We either provide the strong exception guarantee (the variant would still contain the string) -- but this requires double buffering, as for instance boost::variant does. Or we could restrict the alternative types to only those that are nothrow_move_constructible. Or we make this a new state -- "invalid, because the variant has been derailed due to an exception thrown during type changing assignment". Or we say "you shouldn't write code that behaves like this; if you do you're on your own", i.e. undefined behavior. The committee was discussing what to do, and so was The Internet. There are other design decisions -- default construction, visitation etc -- but they are all insignificant compared to how to deal with the throwing, type-changing assignment.

I have tried to present the options and their pros and cons in P0086. In short: it's incredibly difficult and fragile to predict whether a type is_nothrow_move_constructible. And double buffering -- required for a strong exception guarantee -- kills the quest for an efficient variant. But efficiency is one of the main motivations for using a discriminated union.

After the second Library Evolution Working Group (LEWG) review in Lenexa, we got P0088R0: a design that was making this invalid state extremely rare. But if it happened, access to the value would result in undefined behavior. This caused a vivid reaction from the committee members. And from The Internet. Hundreds of emails on the committee email lists. Many many smart and convincing blog posts.

In the end, different parts of the committee strongly supported different designs -- and vetoing other designs. Massive disagreement. So when we came to our C++ Standards Meeting in Kona, it was immediately clear that we needed to expose this to the full committee (and not just LEWG). The expectation was that we would declare variant dead, and keep it locked away for the next five years. At least. (An I would have time to water my fishes again.)

So back to the cliffhanger. On the full committee, Monday evening stage in Kona were David Sankel and I. We presented (and represented) the different design options. While we were discussing with the committee members, live and uncut and on stage, David and I realized that we could make it happen. "The Kona Kompromise": similar to P0088R0, but instead of undefined behavior when extracting the value of such a zombie variant it would just throw!

The Kona Kompromise means that we don't pay any efficiency for the extremely rare case of a throwing move. The interface stays nice and clean. A variant of n alternatives is a "mostly" an n-state type. It offers the basic exception guarantee at no relevant performance loss. It is a safe vocabulary type for every-day use, also for novices. The vast majority of the committee was convinced by this idea. Almost everyone in the room was happy!

Do we have a std::variant now? Not yet. But we are a giant leap closer: variant is now under wording review with the Library Working Group (LWG); I will publish a new revision in the Kona post-mailing (P0088R1). This will get re-reviewed in Jacksonville, first week of March. Once LWG gives the green light, the full committee can vote variant into a Technical Specification (TS) as std::experimental::variant. Now that a large fraction of the committee has expressed its consent (happiness, even!), I expect that this will be in the TS called Library Fundamentals, v3. It might or might not make it into C++17 -- that depends mostly on how quickly I manage to bring P0088 into an acceptable state, and how quickly we will gain use experience with variant.

So there is one thing I'd really appreciate your help with: std::experimental::variant will show up in library implementations near you, likely in their first releases next year. It would be fantastic if you could try it out, and as importantly: give feedback, on the public forums or by contacting me directly (axel@cern.ch). Your feedback will tell us whether the design decisions we took are the right ones, for instance regarding default construction, visitation, performance, and especially converting construction and assignment. As they say here: Mahalo!

Axel Naumann, CERN (axel@cern.ch)

 

CppCast Episode 33: Qt Creator with Tobias Hunger

Episode 33 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Tobias Hunger to discuss the Qt Creator IDE for C++.

CppCast Episode 33: Qt Creator with Tobias Hunger

by Rob Irving and Jason Turner

About the interviewee:

Tobias graduated from the University of Kaiserslautern in Germany with a degree in computer engineering. Before joining Nokia in 2009 to work on Qt Creator he has been a consultant, specializing in systems administration and later Qt software development. He went with Qt to Digia and now works for The Qt Company in Berlin, Germany.

Tobias has been an open source contributor ever since his student days and is now a maintainer in the Qt project, responsible for the version control plugins in Qt Creator. He also is heavily involved with the project management plugins.

In his spare time he does way to many computer related things, but also manages to read books, go to the movies and play with his son.

6 topics on starting and running a User Group

I posted an update on my founding C++ User Groups article from 2 years ago:

6 topics on starting and running a User Group

by Jens Weller

From the article:

Almost two years ago I blogged about founding C++ User Groups, since then I have learned a lot more on the topic, and I want to share that experience with you in this blog post. While my focus here at Meeting C++ is C++, this post is more on the topic of a User Group, so its also useful to you, if you want to start a user group on something else. Yet, I might strive away into C++ lands in this post...

Becoming a Rule of Zero Hero--Glennan Carnie

Everything is in the title:

Becoming a Rule of Zero Hero

by Glennan Carnie

From the article:

Previously, we’ve looked at The Rule of Zero which, in essence, says: avoid doing your own resource management; use a pre-defined resource-managing type instead.

This is an excellent guideline and can significantly improve the quality of your application code. However, there are some circumstances where you might not get exactly what you were expecting. It’s not that the code will fail; it just might not be as efficient as you thought.

Luckily, the solution is easy to implement and has the additional side-effect of making your code even more explicit.

Celebrating 30-th anniversary of the first C++ compiler: let's find bugs in it

The idea to check Cfront occurred to me after reading an article, devoted to the 30-th anniversary of the first Release version of this compiler: "30 YEARS OF C++".

Celebrating 30-th anniversary of the first C++ compiler: let's find bugs in it

by Andrey Karpov, Bjarne Stroustrup

From the article:

Bjarne warned me that checking Cfront could be troublesome: "Please remember this is *very* old software designed to run on a 1MB 1MHz machine and also used on original PCs (640KB). It was also done by one person (me) as only part of my full time job".

Announcing Visual C++ Build Tools 2015 – standalone C++ tools for build environments--Marian Luparu

You can now compile using Visual C++ without Visual Studio:

Announcing Visual C++ Build Tools 2015 – standalone C++ tools for build environments

by Marian Luparu

From the article:

Together with the availability of Visual Studio 2015 Update 1 RC, we’re also announcing a new way of acquiring the C++ tools: as a standalone installer that only lays down the tools required to build C++ projects without installing the Visual Studio IDE. This new installer is meant to streamline the delivery of the C++ build tools in your build environments and continuous-integration systems.

C++ User Group Meetings in November

The montly overview on upcoming C++ User Group Meetings:

23 C++ User Group meetings in November

by Jens Weller

The list:

    4.11 C++ UG Saint Louis - Unit Test++, Scott Meyers "gotchas", group exercise
    4.11 C++ UG Washington, DC - Q & A / Info Sharing
    4.11 C++ UG Austin - OpenMP
    9.11 C++ UG Edinburgh - C++ Edinburgh
    9.11 C++ UG Zentralschweiz - Coding Dojo
    11.11 C++ UG Utah - Regular Monthly Meeting
    11.11 C++ UG San Francisco/ Bay area - Presentation and Q&A
    12.11 C++ UG NRW/Aachen - Variadic Templates und TMP ohne Rekursion
    12.11 C++ UG Dresden - User perspektive on Catch
    16.11 C++ UG Austin - North Austin Monthly C/C++ Pub Social
    17.11 C++ UG Berlin - November Meetup
    17.11 C++ UG Hamburg - OpenCL
    18.11 C++ UG San Francisco/ Bay area - Workshop and Discussion Group
    18.11 C++ UG Warsaw - LLVM a jakość i bezpieczeństwo oprogramowania
    18.11 C++ UG Washington, DC - Q & A / Info Sharing
    18.11 C++ UG Bristol - Thomas Guest
    18.11 C++ UG Düsseldorf - Lightning Talks
    18.11 C++ UG North West/Seattle - CppCon Keynote - Bjarne Stroustrup
    18.11 C++ UG Sacramento - Sacramento Area C++, First Meetup
    25.11 C++ UG San Francisco/ Bay area - Workshop and Discussion Group
    26.11 C++ UG Rhein-Neckar - C++11/C++14 loops of fun
    26.11 C++ UG Bremen - C++ User Group
    26.11 C++ UG Munich - Lightning Talks