Class/struct invariants

Simen kjaeraas simen.kjaras at
Wed Jun 16 07:58:28 PDT 2010

Steven Schveighoffer <schveiguy at> wrote:
> During default struct construction, no constructors are run (they aren't  
> allowed anyways) and no invariants are run.  What would be the point of  
> running an invariant during default construction?  The only think it  
> could possibly do is make code like this:
> S s;
> Fail without -release, and pass with -release.  I don't see the value in  
> that.

Ah, but I do. If it is an error to create an uninitialized struct of
type S, then the above code is a bug, is it not?


More information about the Digitalmars-d-learn mailing list