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

Re: Accessors Question


  • Subject: Re: Accessors Question
  • From: Andy Lee <email@hidden>
  • Date: Thu, 12 Jun 2008 13:33:00 -0400

On Jun 12, 2008, at 1:21 PM, Jeff LaMarche wrote:

Lately, I've started to see accessors of the following sort:

- (NSString *)foo
{
	return [[foo retain] autorelease];
}

I believe this is in case of something like this:


NSString *myFoo = [myObject foo];

// ... stuff that causes myObject to be deallocated ...

NSLog(@"%@", myFoo);  // <--- myFoo might be invalid


I definitely saw this pattern mentioned before GC, so it doesn't have to do with that.


--Andy

_______________________________________________

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: 
 >Accessors Question (From: Jeff LaMarche <email@hidden>)

  • Prev by Date: Re: Simple question - Subclassing NSView
  • Next by Date: Re: Simple question - Subclassing NSView
  • Previous by thread: Re: Accessors Question
  • Next by thread: Re: Accessors Question
  • Index(es):
    • Date
    • Thread