Initialization in modern C++

Speaker: Timur Doumler

Audience level: Intermediate | Advanced

category

Initialization semantics is widely regarded as one of the most difficult aspects of the C++ language. We have many different kinds of initialization and many different syntaxes for it, and they interact in complex and often surprising ways. C++11 introduced the concept of "uniform initialization". But instead of unifying, this feature introduced even more complex rules, which were subsequently amended in C++14, C++17, and will be changed again for C++20.

In this talk, I'll first summarise the history of initialization in C++. I'll then give a systematic overview over the current initialization rules and common pitfalls and surprises. There will be some practical coding guidelines to help using those rules effectively. We will then discuss recent proposals towards making initialization semantics in C++20 simpler and more uniform.