Timur Doumler works at JetBrains, where he develops the C++ frontend for CLion, the cross-platform C++ IDE. In the past he has spent much time working in the audio tech industry and has written code for the JUCE framework. Timur is an active member of the ISO C++ committee and passionate about clean code, good tools, and the evolution of the C++ language. He regularly speaks at conferences and enjoys C++ community work, currently serving as an organiser and program chair for the Audio Developer Conference and as moderator on includecpp.org.
Initialisation semantics is widely regarded as one of the most difficult aspects of the C++ language. We have many different kinds of initialisation and many different syntaxes for it, and they interact in complex and often surprising ways. C++11 introduced the concept of "uniform initialisation". 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 initialisation in C++. I'll then give a systematic overview over the current initialisation 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 initialisation semantics in C++20 simpler and more uniform.