• 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: When does an object own its instance variable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When does an object own its instance variable?


  • Subject: Re: When does an object own its instance variable?
  • From: j o a r <email@hidden>
  • Date: Fri, 17 Aug 2007 13:17:22 +0200


On 17 aug 2007, at 12.26, Tony Wroblewski wrote:

I would do something like the following:

-(void) setName:(NSString *)theName
{
	if (name)
		[name release];
	name = [theName copy];
}


This pattern is not always safe to use as it can crash if you were to call that method with the same object twice. It's typically better to point to the official documentation, and then follow up with whatever clarifications that might be needed in some particular case.

<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/ index.html>

j o a r


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: 
 >When does an object own its instance variable? (From: Bob Ueland <email@hidden>)
 >Re: When does an object own its instance variable? (From: Tony Wroblewski <email@hidden>)

  • Prev by Date: Re: Inheritance question
  • Next by Date: Re: Inheritance question
  • Previous by thread: Re: When does an object own its instance variable?
  • Next by thread: Inheritance question
  • Index(es):
    • Date
    • Thread