Initialization of nested struct fields

Peter Alexander via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 1 16:24:28 PST 2015


On Friday, 2 January 2015 at 00:08:02 UTC, anonymous wrote:
> Apparently dmd thinks that the result of f must be a nested 
> struct. I.e. it needs a context pointer. And I guess hell would 
> break loose if you'd use a nested struct with a null context 
> pointer. At least when the context pointer is actually used, 
> unlike here.

Ah, I see. So the problem is that the nested struct doesn't 
really have a sensible default value, meaning you must initialize 
it explicitly in the constructor.

Thanks for the clarification.


More information about the Digitalmars-d-learn mailing list