Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

Jakob Ovrum via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 16 20:59:20 PST 2015


On Thursday, 17 December 2015 at 04:05:30 UTC, Jeremy DeHaan 
wrote:
> http://dpaste.com/3FH3W13

Also, I would be wary of lazy initialization. We have bad 
experiences with it for AAs and standard containers. A typical 
example would be:

void foo(Wrapper w)
{
     ...
     w.doTheThing();
     ...
}

void main()
{
     Wrapper w;
     foo();
     w.inspect(); // `w` is still a null reference here
}



More information about the Digitalmars-d-learn mailing list