KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've just been bitten by an annoying bug that was made obscure by the "send message to nil is ok" behaviour in Objective-C. I've seen Sending a message to nil? , and the consensus seems to be 'thats how we roll' in Objective-C. Now, maybe I don't have enough experience in Objective-C, but it seems like it would be useful to trap this, because I can't think of a good reason why this should be happening most of the time. However, It could just be a coding idiom I'm not used to yet. So other than checking for nil everywhere like so: assert( object != nil ); [object message]; Is there a way to make the runtime trap this condition, and warn when object is nil?
Tags (comma-separated)
Save Edits
Cancel