Multiple ChoiceBeginner 45s
Function-local static init is thread-safe
Since C++11, a function-local static (`static Foo f;` inside a function) has what initialization property?
Options
- 1No thread safety is provided, so you must guard the first call with your own mutex.
- 2It is initialized separately in every translation unit, so each TU sees its own copy.
- 3It is initialized at program startup, before main runs, in a fixed deterministic order.
- 4Thread-safe initialization once (guarded), so concurrent first calls are safe.
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.