How static local POD constants are initialized? Lazily or not?
<p>POD means primitive data type without constructor and destructor.</p>

<p>I am curious, how compilers handle lazy initialization of POD static local variables. What is the implication of lazy initialization if the function are meant to be run inside tight loops in multithreaded applications? These are the possible choices. Which one is better?</p>

<pre><code>void foo_1() {
    static const int v[4] = {1, 2, 3, 4};
}

void foo_2() {
    const int v[4] = {1, 2, 3, 4};
}
</code></pre>

<p>How about this? No lazy initialization, but slightly clumsy syntax?</p>

<pre><code>struct Bar
{
    static const int v[4];

    void foo_3()
    {
        // do something
    }
};

const int My::v[4] =  {1, 2, 3, 4};
</code></pre>
