Pointers, casting, SetGetWindowLong problem...
torhu
fake at address.dude
Sat Mar 10 03:05:08 PST 2007
Bradley Smith wrote:
> I've started recording "surprises" like these on a Web page here:
> http://www.baysmith.com/d/
That's a good idea, but I see a couple of errors on that page.
At the bottom: "crashes because null not evaluated as false". null does
evaluate to false. The reason it crashes is that assert(obj) doesn't
check for null, it just calls the class invariant.
http://www.digitalmars.com/d/class.html#invariants
And "Don't use == to compare with null" can be a bit misleading. If the
object has an opEquals defined that takes a reference as an argument,
you would actually "use == to compare with null". Maybe if it said
"Don't use == to check if a reference is null".
But it's a nice initiative nevertheless. The official docs are a bit
unclear on many issues.
More information about the Digitalmars-d-learn
mailing list