• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Interpreting Documentation: Is a nil argument OK?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Interpreting Documentation: Is a nil argument OK? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Interpreting Documentation: Is a nil argument OK?
  • Next by Date: NSString to char[]
  • Previous by thread: Interpreting Documentation: Is a nil argument OK?
  • Next by thread: NSString to char[]
  • Index(es):
    • Date
    • Thread