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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to