Invariant for default construction

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 17 16:51:01 PST 2014


On Monday, 17 November 2014 at 20:02:36 UTC, Martin Nowak wrote:
> Walter is about to fix an old bug [1] so that invariants are 
> now called before destruction and for non-default construction.
>
> A remaining question is whether invariants should also be 
> called for default construction [2].
>
> [1]: https://github.com/D-Programming-Language/dmd/pull/4136
> [2]: https://issues.dlang.org/show_bug.cgi?id=519#c11

We don't have default constructor. So we need to be able to rely
on a struct being in a invalid state at default construction.

Solution obviously being to have default constructor and to run
the invariant after default construction.


More information about the Digitalmars-d mailing list