Default struct constructor

bitwise bitwise.pvt at gmail.com
Wed Feb 6 14:49:28 UTC 2019


On Thursday, 31 January 2019 at 13:57:41 UTC, Jonathan M Davis 
wrote:
>
> It wouldn't necessarily be impossible to have it, but the 
> language was designed around default initialization and not 
> default construction, and adding default construction into the 
> mix would likely cause some confusing corner cases and 
> generally not work very well.

If I can do this:

struct A {
     int n;
}

A a = void;

Maybe I should be able to do this too:

struct S {
     this(void) { ... }   // <--- make more explicit by adding void
}

S s = S();


More information about the Digitalmars-d mailing list