On Dec 2, 2015, at 9:28 PM, Jens Alfke <[email protected]> wrote: > > It’s not a weird situation at all. Something returns you an object pointer. > You call a method on that object. But the pointer you got happens to be NULL. > Ergo, you’ve just called a method on a NULL pointer. > Widget *w = factory.getCurrentWidget(); > Paint *p = w->getPaint(); > If the currentWidget is NULL, the second line does this.
I’d argue that if getCurrentWidget() can return a null you should never invoke w->getPaint() without first checking that w is not null. Isn’t it a compiler implementation detail that w->getPaint under the covers turns into getPaint(w)? w->getPaint is in effect dereferencing a null w. That fits the quoted portion of the standard. At least that is how I see it. _______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com This email sent to [email protected]
