Cocoa with Love : Testing if an arbitrary pointer is a valid object pointer

Again, there is a good article at Cocoa with Love.

With Objective-C/Cocoa, I tend to worry about invalid pointer, especially NULL pointer, than with C++/MFC. It is because it is valid to call a message, or method, of a nil object.
However, it doesn’t mean that you can rely on the result of such calling. What’s important is that the result of such calling is negligible.

However, there will be cases where a pointer to an object contain some wrong value.
Then calling or sending a message of such object can yield crash. Therefore it is good to have a way to check the validity of such pointer.

Click this link and let’s learn how people at Cocoa with Love solved it.
Testing if an arbitrary pointer is a valid pointer.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: