Hey guys,
I was wondering if objective C does any check to see if a pointer to an object is nil before calling the function.
For example, say I have a
myObject* ptr;
and initialize
ptr = nil;
and call
[self myFunction:ptr];
where myFunction is my own function and does no check to see if the object is nil. I heard somewhere that objective C will not call the function if it is nil? Is this true and would my code be safe?
The reason I ask is because I'm implementing a universal app, and have an UIView instance that will only work for the ipad. But, I do many function calls for this view, and instead of doing condition checks to see if it is an ipad before calling the function, it would be great if I could set the view as nil if it's an iphone.
Also, if the interface builder allocated the object and I set the pointer to nil, will there be a memory leak or will the builder know to dealloc the object?
Thanks