struct and default constructor

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 12 09:31:38 PDT 2014


On 10/10/2014 22:19, monarch_dodra wrote:
> Think the argument is that declaring `T t;` must be CTFE, which kind of
> implies a T.init state (which may have non-deterministic values in the
> presence of " = void").
>
> This is mostly for declaring things static, and the whole "constructors
> are run after the .init blit".
>
> But even then:
> T t; //value is T.init, if not @disable this()
> T t = T(); //Potentially run-time
>
> I've started threads and tried to start discussions about this before,
> but to no avail. It's a relativelly recurrent complain, especially from
> "newer" C++ users.

Totally agree, and it doesn't help that some D proponents ignore this 
point and just repeat "it doesn't work with the design of D". Whenever 
there is a weak explanation for something it will damage D, to some 
extent. In those cases it would be much better if a convincing argument 
can be written up as a website FAQ, or at least state that more research 
is needed before a solution can be tried.


More information about the Digitalmars-d mailing list