On 10.03.2010 21:28, Walter Bright wrote:

template Foo()
{
static int _a;
static int a()
{
static bool _a_inited;
if (!_a_inited)
{ _a_inited = true;
_a = 42;
}
return _a;
}
}

Lazy initialization requires some kind of synchronization when a is shared. Static initialization does not have that drawback.

Reply via email to