• 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: retain/release question about Apple docs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: retain/release question about Apple docs


  • Subject: Re: retain/release question about Apple docs
  • From: Ricky Sharp <email@hidden>
  • Date: Sun, 5 Mar 2006 20:28:36 -0600


On Mar 5, 2006, at 7:43 PM, James W. Walker wrote:

In Apple's "Text System Overview", under "Building a Text Editor in 15 Minutes", there is the code:

- (void) setString: (NSAttributedString *) newValue {

    if (mString != newValue) {

        [newValue retain];

        if (mString) [mString release];

        mString = [newValue copy];

        [newValue release];

    }

}

I thought I understood the retain/release/autorelease business, but I can't see the need for the [newValue retain] and [newValue release] here.

See the following link; it illustrates reasons to use the many different accessor patterns:


<http://www.stepwise.com/Articles/Technical/2002-06-11.01.html>

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >retain/release question about Apple docs (From: "James W. Walker" <email@hidden>)

  • Prev by Date: (no subject)
  • Next by Date: Re: retain/release question about Apple docs
  • Previous by thread: retain/release question about Apple docs
  • Next by thread: Re: retain/release question about Apple docs
  • Index(es):
    • Date
    • Thread