Re: Style question
Re: Style question
- Subject: Re: Style question
- From: Ken Thomases <email@hidden>
- Date: Mon, 30 Aug 2010 10:35:22 -0500
On Aug 30, 2010, at 10:29 AM, Vincent Habchi wrote:
> just an enquiry regarding coding style. What is considered best:
>
> baz = [[[Foo alloc] init] autorelease];
> …
> return baz;
>
> or
>
> baz = [[Foo alloc] init];
> …
> return [baz autorelease];
>
> ?
As with most style questions, there's no definitive answer. It's up to you.
Probably, if you know you're going to auto-release the object, it's best to do it immediately. That's safe against early returns, exceptions, reassigning 'baz' to point to another object, etc.
Regards,
Ken
_______________________________________________
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