Re: Autorelease Question
Re: Autorelease Question
- Subject: Re: Autorelease Question
- From: "Shawn Erickson" <email@hidden>
- Date: Wed, 19 Nov 2008 15:02:26 -0800
On Wed, Nov 19, 2008 at 2:37 PM, Carmen Cerino Jr. <email@hidden> wrote:
> I am not sure the best way to phrase this question into words, so I
> will phrase it using example code.
>
> - (NSString*)foo
> {
>
> NSString blah = [NSString string];
>
> .........
>
>
> //Now do I do:
> return blah;
>
> //Or:
> return [[blah retain] autorelease]];
> }
In the end either of the above are OK (assuming you add the "*" after
NSString)... the later return version is simply unneeded in the
example you have shown.
Of course [NSString string] is just an empty string and they are
immutable so your example doesn't make much sense.
-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