This week in D #13: =void tip, ddmd, if(arr) warn, dconf registration

via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Apr 13 02:15:28 PDT 2015


On Monday, 13 April 2015 at 03:37:17 UTC, Adam D. Ruppe wrote:
> http://arsdnet.net/this-week-in-d/apr-12.html
>
> http://www.reddit.com/r/d_language/comments/32ek17/this_week_in_d_13_void_tip_ddmd_ifarr_warn_dconf/
>
> https://twitter.com/adamdruppe/status/587459000729473024

The example in the first point of "void initialization" is wrong:

     YourStruct s = YourStruct();

With `@disable this()`, this doesn't work either. But this does:

     YourStruct s = YourStruct.init;

About point 3, the following should be added so as not to mislead 
beginners:
This is assignment, not construction! This is an important 
distinction, because your type's opAssign() and ~this() can then 
be invoked on an uninitialized object. They need to be aware of 
that possibility.


More information about the Digitalmars-d-announce mailing list