any tool to at least partially convert C++ to D (htod for source

Justin Johansson no at spam.com
Wed Mar 10 13:01:42 PST 2010


Max Samukha Wrote:

> 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.

Indeed and synchronization is costly.





More information about the Digitalmars-d mailing list