• 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: Is this a bug of the Cocoa or the Objective-C?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this a bug of the Cocoa or the Objective-C?


  • Subject: Re: Is this a bug of the Cocoa or the Objective-C?
  • From: Nick Zitzmann <email@hidden>
  • Date: Thu, 25 Jan 2007 22:08:17 -0700


On Jan 25, 2007, at 9:58 PM, JongAm Park wrote:

Let's assume that theRange has {0, 6} in the previous iteration.
if the keyString is "nil", the rangeOfString.. method returns nil.
However, it can't update the theRange variable, so it thinks that it found
the searchString.


Is this inevitable bug, because the Objective-C is a dynamic language?

No, and this is not a bug. When a message is sent to a nil object, if the selector returns an object, the result is nil, but if it returns a data structure or primitive (as in the case you cited), then the results are not defined. On most types it returns zeroes anyway, but it's a bad idea to rely on that.


Nick Zitzmann
<http://www.chronosnet.com/>




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Is this a bug of the Cocoa or the Objective-C?
      • From: JongAm Park <email@hidden>
References: 
 >Is this a bug of the Cocoa or the Objective-C? (From: JongAm Park <email@hidden>)

  • Prev by Date: Is this a bug of the Cocoa or the Objective-C?
  • Next by Date: Color Table Animation
  • Previous by thread: Is this a bug of the Cocoa or the Objective-C?
  • Next by thread: Re: Is this a bug of the Cocoa or the Objective-C?
  • Index(es):
    • Date
    • Thread