Struct default constructor - need some kind of solution for C++ interop

Joseph Rushton Wakeling via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 7 16:17:56 PDT 2016


On Wednesday, 7 September 2016 at 22:31:17 UTC, Walter Bright 
wrote:
> On 9/7/2016 3:24 PM, John Colvin wrote:
>> What, precisely, does "valid" mean in the above?
>
> S is initialized to a valid state, meaning the fields are not 
> filled with garbage, and are in a state expected by the member 
> functions.
>
> But if there's a default constructor,
>
>     S s = S.init;
>     S s;
>
> which is correct?

Potentially naive question, but is there any reason why, if a 
default constructor exists, S.init shouldn't just be the same as 
the result of calling the default constructor?


More information about the Digitalmars-d mailing list