• 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: copyWithZone - if anyone could explain this to me ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: copyWithZone - if anyone could explain this to me ?


  • Subject: RE: copyWithZone - if anyone could explain this to me ?
  • From: Jeff Laing <email@hidden>
  • Date: Tue, 1 Dec 2009 01:26:09 +0000
  • Acceptlanguage: en-US
  • Thread-topic: copyWithZone - if anyone could explain this to me ?

> In most cases, yes. However, copyWithZone: is special, the superclass'
> implementation just blindly copies all of the raw bits in the source
> object to the newly created one. If you were to use the normal
> -setImage: call, that old value would be released one too many times.
> Assigning to the instance variable in this case is the way to avoid
> that.

Why would you not just do:

	[cell->image retain];

That makes it a lot clearer to me - since it was a bitwise copy, cell->image and image are identical values whereas the assignment looks like you are changing something.

_______________________________________________

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: copyWithZone - if anyone could explain this to me ?
      • From: "Clark S. Cox III" <email@hidden>
    • Re: copyWithZone - if anyone could explain this to me ?
      • From: Graham Cox <email@hidden>
References: 
 >copyWithZone - if anyone could explain this to me ? (From: Mario KuĆĄnjer <email@hidden>)
 >Re: copyWithZone - if anyone could explain this to me ? (From: Clark Cox <email@hidden>)

  • Prev by Date: Re: copyWithZone - if anyone could explain this to me ?
  • Next by Date: Re: copyWithZone - if anyone could explain this to me ?
  • Previous by thread: Re: copyWithZone - if anyone could explain this to me ?
  • Next by thread: Re: copyWithZone - if anyone could explain this to me ?
  • Index(es):
    • Date
    • Thread