Re: DMD on x86_64

2010-03-25 Thread Chinedu Okonkwo
Robert Clipsham Wrote: > On 18/02/10 15:13, Jesse Phillips wrote: > > Please place them on Wiki4D, probably a sub-section under AMD64. If you > > don't I will, but I'll give you a chance :) > > > > http://www.prowiki.org/wiki4d/wiki.cgi?D__Tutorial/StartingWithD/Compiler/DMD > > Done, I hope it'

Never called destructor

2010-03-25 Thread Zarathustra
Why, in the following piece of code, destructor for 'x' is never called? class A{ char [] s; this(char [] o_s){ s = o_s; } ~this(){ writefln(s); }; } void main(){ A y; { scope A x = new A("x".dup); y = new A("y".dup); x = y; // } } output: y // where is x Destructors fo

Re: Never called destructor

2010-03-25 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Zarathustra wrote: > Why, in the following piece of code, destructor for 'x' is never called? > Because it is not guaranteed to be called. http://www.digitalmars.com/d/2.0/class.html#destructors According to the spec, for the cases you've provided

Re: Never called destructor

2010-03-25 Thread bearophile
div0: > scope x = new A("x"); > y = new A("y"); > x = y; In my opinion it's better to not reassign references of scoped objects. In real programs where possible it's better to write boring and stupid code :-) Bye, bearophile

initializing immutable structs

2010-03-25 Thread Paul D. Anderson
I want to initialize an immutable struct but I'm encountering two difficulties and I can't find the answer in the documentation. (Wouldn't it be nice if someone wrote a book?) The primary difficulty is that I can't use a static initializer but need to use a constructor instead. But the construc