Question about Object.destroy

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Sep 20 11:41:18 PDT 2015


On Sunday 20 September 2015 20:34, Lambert Duijst wrote:

> On Sunday, 20 September 2015 at 18:21:52 UTC, Adam D. Ruppe wrote:
[...]
>> So after calling destroy(s), s is null, so it segfaults when 
>> you try to use it.
[...]
> Also when I print the address of s it gives me some hex number, 
> but not 0 (null).
> I use writeln("Address of s ", &s) to print the address, not sure 
> if that is correct though.
> Before and after the explicit destroy I get the same address, 
> which is 7FFF549108D8.

&s is the address of the variable. We're not interested that but in the 
reference that's stored in s. You can print that by casting to void*:

writeln(cast(void*) s);

But that doesn't change either. I think Adam is mistaken here.


More information about the Digitalmars-d-learn mailing list