• 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: new class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new class


  • Subject: Re: new class
  • From: Shawn Erickson <email@hidden>
  • Date: Fri, 21 Sep 2007 07:17:09 -0700


On Sep 21, 2007, at 4:53 AM, Alan Smith wrote:

Hi,

You retain an object when you want to have reference to it later. For
example, to set an ivar you do something like this:

- (void)setString:(NSString*)string
{
  [_string release];
  _string = [string retain];
}

Hope this helps and isn't confusing.

All fine and good unless string and _string are the same object. :)

Review...

<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/ Articles/mmAccessorMethods.html#//apple_ref/doc/uid/TP40003539>

The "zero" rule of Cocoa memory management.... the rules are easy believing the rules are that easy is the hard part.

-Shawn
_______________________________________________

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: 
 >new class (From: H M <email@hidden>)
 >Re: new class (From: PGM <email@hidden>)
 >Re: new class (From: "Shawn Erickson" <email@hidden>)
 >Re: new class (From: H M <email@hidden>)
 >Re: new class (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: UI Effects
  • Next by Date: Re: Need help with -mutableSetValueForKey:
  • Previous by thread: Re: new class
  • Next by thread: Re: new class
  • Index(es):
    • Date
    • Thread