Why does initialization of local static objects use hidden guard flags?
问题 Local static objects in C++ are initialized once, the first time they are needed (which is relevant if the initialization has a side effect): void once() { static bool b = [] { std::cout << "hello" << std::endl; return true; } (); } once will print "hello" the first time it is called, but not if it is called again. I've put a few variations of this pattern into Compiler Explorer and noticed that all of the big-name implementations (GCC, Clang, ICC, VS) essentially do the same thing: a hidden