Skip to content

The Static Initialization Order Fiasco - How to Properly Initialize Global State

Photo of Andreas Weis
Hosted By
Andreas W. and 3 others
The Static Initialization Order Fiasco - How to Properly Initialize Global State

Details

https://www.twitch.tv/mucplusplus/

Today we have the pleasure to welcome Jonathan Müller to our user group. Jonathan is a Computer Science graduate currently studying Physics. In his spare time he works on various C++ open source libraries for memory allocation, cache-friendly containers or parsing. He also blogs about C++ and library development at foonathan.net.

---------------------------
Abstract: Global variables are initialized before `main()` runs, but the relative initialization order is not necessarily well-defined. As such, accessing global state while you initialize your global variables, might not work the way you expect.

A simple solution is to stop using global variables completely. However, it is not always an option, so in this talk we'll discuss some real solutions to the problem. We'll cover simple wrappers, lazy initializers and nifty counters. And of course, we'll also discuss the best solution of them all - moving initialization to compile time with the help of `constexpr` and C++20's `consteval` and `constinit` keywords.

---------------------------
Schedule:
19:00 (CEST) -- Start of the videostream

Photo of MUC++ group
MUC++
See more events
Online event
This event has passed