• 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: Definition of Nil and nil was: NSData testing for NULL [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Definition of Nil and nil was: NSData testing for NULL [SOLVED]


  • Subject: Re: Definition of Nil and nil was: NSData testing for NULL [SOLVED]
  • From: Mark Ritchie <email@hidden>
  • Date: Mon, 17 Jan 2005 11:08:53 -0500

On Jan 17, 2005, at 10:15 AM, Guy English wrote:
So [nil intValue] will work fine and return 0 (or nil if you're
expecting and object, NO for a boolean). But "[nil floatValue]" or
"[nil frame]" will fail and you'll get an undetermined result - the
garbage that's either on the stack or sitting in the float register at
the time. I'm just pointing this out because it's an annoying bug to
track down if you're assuming that messaging nil will do the right
thing in all cases.

This has been an interesting 'feature' of Objective-C for as long as I can remember. Apparently we need to link to a FAQ somewhere that has a full list of all the caveats! (Although, then we'd have to convince people to read the whole dang thing! :-)

Mark.
__
Mark Ritchie, email@hidden 416-843-5479
Software Developer, Apple Certified Developer Trainer
WebObjects, Cocoa, Mac OS X and Mac OS X Server
Diamond Lake Consulting Inc., Toronto, Ontario, Canada

_______________________________________________
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


  • Follow-Ups:
    • Re: Definition of Nil and nil was: NSData testing for NULL [SOLVED]
      • From: mmalcolm crawford <email@hidden>
    • Re: Definition of Nil and nil was: NSData testing for NULL [SOLVED]
      • From: Dave Rosborough <email@hidden>
References: 
 >NSData testing for NULL (From: Robin Hermann <email@hidden>)
 >Re: NSData testing for NULL [SOLVED] (From: Robin Hermann <email@hidden>)
 >Re: NSData testing for NULL [SOLVED] (From: Mark Ritchie <email@hidden>)
 >Re: NSData testing for NULL [SOLVED] (From: Robin Hermann <email@hidden>)
 >Definition of Nil and nil was: NSData testing for NULL [SOLVED] (From: Mark Ritchie <email@hidden>)
 >Re: Definition of Nil and nil was: NSData testing for NULL [SOLVED] (From: Guy English <email@hidden>)

  • Prev by Date: Re: Reveal in Finder Sample Code
  • Next by Date: Re: Inserting text
  • Previous by thread: Re: Definition of Nil and nil was: NSData testing for NULL [SOLVED]
  • Next by thread: Re: Definition of Nil and nil was: NSData testing for NULL [SOLVED]
  • Index(es):
    • Date
    • Thread