CppCon 2018

This was the first time I was at the CppCon, and it was an overwhelming experience for me.


Pre-conference Classes

I gave one of the two days pre-conference classes. Other classes were given by Nicolai Josuttis, Alexandrei Alexandrescu, and Scott Meyers. My class "Multithreading with Modern C++" went very well. I had more than 30 very active participants. The first day was about the basic stuff such as threads, tasks, locks, and condition variables. The second day was more experimental. We discussed atomics, the memory model, and verified our code with the interactive C/C++ memory model checker CppMem. I also made a detour the Parallel Standard Template Library and the concurrent future (C++20/23) of C++.

Here are my impressions and the talks I enjoyed the most. You should watch them on YouTube in a few weeks.

Keynote: Concepts: The Future of Generic Programming by Bjarne Stroustrup (MD, MorganStanley)


Bjarnes talk was not technical but presented the key ideas as the design principles of concepts. He started his presentation with the motivation and history of concepts. Concepts have a long history in C++. Alexander Stepanov (father of the Standard Template Library) with his book Elements of Programming is their main inspiration.

Bjarne also talked about the benefits of concepts. We will get specific error messages, specify our intent, make our code more readable, and give the compiler optimisation hints.

Concepts are compile time predicates the should not model minimal requirements such as HasAdd but support interoperability. Concepts are not type of types such as type classes, because the can take types and values. Now the question is. Who should concepts look like? Concepts can model mathematical ideas such as group or ring, but also concrete ideas such as Number or Sortable. You can define your one concept or build concepts based on existing ones. Bjarne also answered the question: What are their design principle:

  • Provide good interfaces.
  • Look for semantic coherence.
  • Don't force users to do what machines do better.
  • Keep simple things simple

Once more. This was a great keynote because of the big picture about concepts.

The C++ Execution Model from Bryce Adelstein Lelbach (Senior Software Engineer, NVIDIA)


In contrast to the keynote, Bryce talk was quite technical and quite advanced. Bryce explained terms which are essential to get a solid understanding of the execution of a single threaded and also a multithreading program. He explicitly excluded the infamous memory order std::memory_order_consume.

First of all, there is the as-if rule. This means the system (compiler, processor, memory) can perform all optimisations which do not change the observable behaviour of a single-threaded program.

Bryce presented the C++ standard as an abstract machine, talked about threads and threads of execution and defined terms such as expression, evaluation, side-effect, sequenced-before, execution steps, and forward progress. Let me refer to the term sequenced-before. In the single-threaded case, sequence-before causes a happens-before relation. In the multi-threaded cases, a happens-before relation is created by synchronize-with. In essence, without a happens-before relation, your multi-threading program has a data-race. Bryce talk was quite advanced but also quite comfortable for me, because I use this terms in my presentations or workshops to the memory model.

Why and How to Roll Your Own std::function Implementation by Tom Poole (Senior Software Developer, ROL)


To make it short. Tom's talk was this kind of presentation I like very much. First, the entire talk was advanced but not too advanced. Second, I learned a lot about implementing std::function. std::function is a polymorphic wrapper for callables in C++ such as function, function objects, or lambda functions.

Tom Poole is a maintainer of the JUCE open source, cross platform, C++ framework for audio applications. Due to the unique performance and memory requirements and the fact, that std::function is not available on all platforms, JUCE support an own version of std::function. Tom presented the challenges of implementing it. This challenges included the avoidance of dynamic memory allocations, locks, but also type erasure.  In the end, he had an implementation which a performance comparable to the performance of std::function.

Sane and Safe C++ Class Types from Peter Sommerlad (Professor, HSR Rapperswill)


First, Peter used sane and safe to divide types into four categories. Based on his categorisation, he discussed types.

Sane and Safe

With empty types or values types (regular types), we are in the sane an safe category. But this does not hold for plain pointers, polymorphic types, or built-in types such as (bool, int, double's).

In-sane and In-safe

They are in-sane and in-safe. Maybe you wonder, why builtin-types belong into this category. The reason is quite easy. They can be victims of integral promotion, numeric conversions, or have special values such as +Inf, -Inf, or NaN. To make a built-in type safe and sane, use the Whole Value Pattern from Ward Cunningham. The question is? What is sane and in-safe.

Sane and In-safe

For example, pointing types such as iterators, smart pointers, references, reference wrappers, or views (std::string_view) are sane and in-safe. With C pointers we are in the in-sane and in-safe ar

This was a great talk which should be part of each C++ curriculum!

Trainer Panel

Thanks to Jon Kalb, I was on Thursday with Jason Turner and Dan Saks at a trainer panel. With had 60 minutes to talk about our training and answered a lot of questions from the audience.

What do you mean thread-safe? by Geoffrey Romer (Software Engineer, Google)

Maybe you want to know why I visited this talk? The reason is that a well-defined terminology is a key in multithreading programs. Often issues in multithreaded programs arise because people understand a different thing by using the same terms. First of all, Geoffrey used the term API race instead of data race which is used by the standard.

  • API race: The program performs two concurrent operations on the same object when the object's API doesn't permit those operations to be concurrent.

The difference of an API race to a data race is that a data race occurs if a read and a write operation happen at the same time on the same memory location. This definition of a data race includes two write operations. An API talks about operations that should not be performed concurrently on the same object.

The focus of the terms is mainly about types and not about functions. Each type belongs to one of the three following categories.

  1. If a live object has a thread-safe type, it can't be the site of an API race.
  2. If a live object has a thread-compatible type, it can't be the site of an API race if it's not being mutated.
  3. The remaining objects are not thread-compatible.

An atomic value is an example for the category one and a const variable for the category two. 

Here are final tips form Geoffrey: Have thread-safe types or immutable thread-compatible types if necessary.

Although I can not write so much about this 30 minutes talk, it was fascinating. I understand during his talk that we need a well-defined terminology for our types to reason about multithreading programs.

My Last Words

Two days pre-conference class, five days conference, this was quite an overwhelming experience for me and, to be honest, quite exhaustive. Of course, the talks were great and I learned a lot but this not my main takeaway. I loved the personal talks I had during and after the conference. I had a lot of talks with people I know for a few years but never meet personally.  Once more thanks a lot for inviting me, Jon.




Thanks a lot to my Patreon Supporters: Eric Pederson, Paul Baxter,  Meeting C++, Matt Braun, Avi Lachmish, Roman Postanciuc, Venkata Ramesh Gudpati, Tobias Zindl, Mielo, and Dilettant.


Get your e-book at Leanpub:

The C++ Standard Library


Concurrency With Modern C++


Get Both as one Bundle

cover   ConcurrencyCoverFrame   bundle
With C++11, C++14, and C++17 we got a lot of new C++ libraries. In addition, the existing ones are greatly improved. The key idea of my book is to give you the necessary information to the current C++ libraries in about 200 pages.  

C++11 is the first C++ standard that deals with concurrency. The story goes on with C++17 and will continue with C++20.

I'll give you a detailed insight in the current and the upcoming concurrency in C++. This insight includes the theory and a lot of practice with more the 100 source files.


Get my books "The C++ Standard Library" (including C++17) and "Concurrency with Modern C++" in a bundle.

In sum, you get more than 600 pages full of modern C++ and more than 100 source files presenting concurrency in practice.


 Get your interactive course at educative

Modern C++ Concurrency in Practice: Get the most out of any machine


Based on my book "Concurrency with Modern C++" educative.io created an interactive course.

What's Inside?

  • 140 lessons
  • 110 code playgrounds => Run in browser
  • 78 code snippets
  • 55 illustrations


+1 #1 Jon Kalb 2018-10-05 17:40
Rainer, Thanks for the kind words and I look forward to seeing you at CppCon 2019.


Add comment

Subscribe to the newsletter (+ pdf bundle)

Blog archive

Source Code


Today 2621

All 1164601

Currently are 139 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments