This Week in D, issue 1

aldanor via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Jan 15 02:00:43 PST 2015


On Thursday, 15 January 2015 at 09:46:52 UTC, Szymon Gatner wrote:
> On Tuesday, 13 January 2015 at 14:08:58 UTC, Adam D. Ruppe 
> wrote:
>> I've started writing a weekly D newsletter. Here's the first 
>> issue, any feedback welcome!
>>
>> http://arsdnet.net/this-week-in-d/jan-12.html
>>
>> In the future, I intend to have it written by Saturday for a 
>> weekend release, so if you want something to appear this week, 
>> please try to get it to by before then.
>
> Fantastic inititive Adam, thanks for donating your time for 
> this.
>
> An issue I have tho:
>
> // classes are reference types, so they must be
> // initialized. "MyClass c;", unlike in C++, would
> // leave c as null, causing a segfault when you try
> // to use it.
>
> That is not really true, is it? In C++ "MyClass c;" is actually 
> THE way to instantiate objects. I know you meant MyClass* but 
> as it is now it is just plain incorrect.
Eh.. what exactly is incorrect? In C++ "MyClass c;" 
stack-allocates the class assuming the default constructor is 
there (unless of course this is a member declaration in an object 
that's static or heap-allocated). In D it doesn't, it leaves you 
with an unitialized reference type.


More information about the Digitalmars-d-announce mailing list