Pointers, casting, SetGetWindowLong problem...
Bradley Smith
digitalmars-com at baysmith.com
Sat Mar 10 13:13:17 PST 2007
torhu wrote:
> 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.
Thanks for the feedback. I've updated these points.
More information about the Digitalmars-d-learn
mailing list