Re: Interpreting Documentation: Is a nil argument OK?
Re: Interpreting Documentation: Is a nil argument OK?
- Subject: Re: Interpreting Documentation: Is a nil argument OK?
- From: John Stiles <email@hidden>
- Date: Sun, 24 Jul 2005 09:48:22 -0700
Jerry Krinock wrote:
In general, can I assume that, if a restriction on nil arguments is not
stated in the documentation for a method, that it is OK to do it?
Example:
NSString -isEqualToString:(NSString*)aString
Returns YES if aString is equivalent to the receiver (if they have the same
id or if they are NSOrderedSame in a literal comparison), NO otherwise. When
you know both objects are strings, this method is a faster way to check
equality than isEqual:.
My code may sometimes send aString=nil. I am not seeing any crashes. Am I
relying on unsupported behavior?
I am not sure but I think that yes, you are getting lucky.
I would make an opposite assumption from yours--if a NULL argument isn't
explicitly listed as being OK, it's not OK.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden