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 (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 arch...@mail-archive.com

Reply via email to