On Tuesday, 14 May 2013 at 12:20:00 UTC, Andrej Mitrovic wrote:
On Tuesday, 14 May 2013 at 12:18:20 UTC, simendsjo wrote:
Very newbie question coming up :)
How does D mark null values for classes?
`c is null` returns true, but `&c` isn't 0.
So how does D know `c is null`?
class C {}
C c;
assert(c is null);
assert(cast(size_t)&c == 0); // fails.
That's the address of the reference. If you want the address of
the object:
assert(cast(size_t)cast(void*)c == 0); // passes
Ah. Thanks to you both. Now I have some strange bug where
somewhere in my code (probably using alias for passing symbols to
templates), it get's a "wrong" reference...