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

Re: Style question


  • Subject: Re: Style question
  • From: "A.M." <email@hidden>
  • Date: Mon, 30 Aug 2010 11:34:06 -0400

On Aug 30, 2010, at 11:29 AM, Vincent Habchi wrote:

> Hi everybody,
>
> 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];
>
> ?

According to the Google Objective-C Style Guide, the former is preferable. The rationale for this is pretty solid, too:

http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml?showone=Prefer_To_autorelease_At_Time_of_Creation#Prefer_To_autorelease_At_Time_of_Creation

Cheers,
M_______________________________________________

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: 
 >Style question (From: Vincent Habchi <email@hidden>)

  • Prev by Date: Re: Style question
  • Next by Date: Re: Style question
  • Previous by thread: Re: Style question
  • Next by thread: Re: Style question
  • Index(es):
    • Date
    • Thread