Are non-local thread storage duration objects initialized to 0 in C?
static thread_local int x; // is x initialized to 0?
The C17 standard says the below (in 6.2.4.4).
An object whose identifier is declared with the storage-class specifier _Thread_local has thread storage duration. Its lifetime is the entire execution of the thread for which it is created, and its stored value is initialized when the thread is started.
It does not explicitly say it is initialized to 0. But the C++ standard makes it explicit and says: (in 3.6.2.2)
Variables with static storage duration ([basic.stc.static]) or thread storage duration ([basic.stc.thread]) shall be zero-initialized ([dcl.init]) before any other initialization takes place
So, does C initialize non-local thread_local objects to 0 or not?