cast(size_t)&c != 0, but c is null

simendsjo simendsjo at gmail.com
Tue May 14 05:18:17 PDT 2013


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.


More information about the Digitalmars-d-learn mailing list