• 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
Stale Objective-C object pointer detection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stale Objective-C object pointer detection


  • Subject: Stale Objective-C object pointer detection
  • From: Alex Curylo <email@hidden>
  • Date: Sun, 13 Apr 2008 13:35:37 -0700


On 13-Apr-08, at 1:06 PM, Greg Titus wrote:
The big difference is that in Objective-C, trying to send a message to nil results in a no-op instead of an access violation, so your defensive C++ practice is actually going to tend to mask those same errors in Objective-C and make them harder to track down.

*smacks forehead*

Yeah, now that I actually think about it, that would be the effect, wouldn't it. Just hadn't made the connection up 'til now, somehow. Thank you.

OK, then, what would an equivalently useful value to set a released Objective-C object pointer/ivar to in order to cause any subsequent access of it to stop the program immediately? 0xDEADBEEF perhaps?

--
Alex Curylo -- email@hidden -- http://www.alexcurylo.com/

Programming is like sex...
One mistake and you support it the rest of your life.





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: Stale Objective-C object pointer detection
      • From: Bill Bumgarner <email@hidden>
    • Re: Stale Objective-C object pointer detection
      • From: Greg Titus <email@hidden>
References: 
 >Re: Cocoa-dev Digest, Vol 5, Issue 600 (From: Alex Curylo <email@hidden>)
 >Re: Cocoa-dev Digest, Vol 5, Issue 600 (From: Greg Titus <email@hidden>)

  • Prev by Date: Re: Why should we set ivars to nil in dealloc?
  • Next by Date: Re: KVO strangeness under 10.5
  • Previous by thread: Re: Cocoa-dev Digest, Vol 5, Issue 600
  • Next by thread: Re: Stale Objective-C object pointer detection
  • Index(es):
    • Date
    • Thread