• 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: Zeroing out instance variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Zeroing out instance variables


  • Subject: Re: Zeroing out instance variables
  • From: "Paul Sanders" <email@hidden>
  • Date: Sat, 17 Apr 2010 18:20:36 +0100

> I think my approach, with the excellent modifications suggested by
> Ken Thomases, makes me less nervous than the others proposed, since it
> touches only my own ivars and makes no assumptions about the nature of
> the rest of the bits in the object.

OK, best of luck.  I think that 64-bit Obj-C's support for non-fragile instance variables might break the bitwise copy idea anyway, I'm not sure.  Other than that I think it would be OK, especially if you knock out retain and release (i.e. override them to do nothing).

It might be wise to start zeroing you iVars at offset class_getInstanceSize([NSObject class]).  That way you don't care how many 'hidden' iVars NSObject has or what size they are.  I think, in fact, that was Ken's intention.

Paul Sanders.
_______________________________________________

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

References: 
 >Zeroing out instance variables (From: Ben Haller <email@hidden>)
 >Re: Zeroing out instance variables (From: Graham Cox <email@hidden>)
 >Re: Zeroing out instance variables (From: Ben Haller <email@hidden>)
 >Re: Zeroing out instance variables (From: "Paul Sanders" <email@hidden>)
 >Re: Zeroing out instance variables (From: Ben Haller <email@hidden>)
 >Re: Zeroing out instance variables (From: "Paul Sanders" <email@hidden>)
 >Re: Zeroing out instance variables (From: Ken Thomases <email@hidden>)
 >Re: Zeroing out instance variables (From: "Paul Sanders" <email@hidden>)
 >Re: Zeroing out instance variables (From: Ken Thomases <email@hidden>)
 >Re: Zeroing out instance variables (From: "Paul Sanders" <email@hidden>)
 >Re: Zeroing out instance variables (From: Ben Haller <email@hidden>)

  • Prev by Date: Re: program termination after releasing self defined NSXMLParser class
  • Next by Date: Looking for examples of UIScrollView using Core Data
  • Previous by thread: Re: Zeroing out instance variables
  • Next by thread: Re: Zeroing out instance variables
  • Index(es):
    • Date
    • Thread