• 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: Code style guidelines
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code style guidelines


  • Subject: Re: Code style guidelines
  • From: Gwynne <email@hidden>
  • Date: Thu, 20 May 2004 11:35:03 -0400

On May 20, 2004, at 11:03 AM, Christoffer Lerno wrote:
I'm trying to figure out some good, consistent style for my obj-c code. Obviously there is the naming guidelines, but what about spacing?

Are there any preferred way of writing

-(id) someMethod:(NSObject*)anObject?

I've seen spacing like this

- (id)someMethod:(NSObject *)anObject

and many other variants.

Anything to recommend?

When in doubt, I'd go with what the Apple headers use, in most cases. My preferred style looks like this when it comes to methods:

- (id)someMethodWithParameters:(id)object andMoreParams:(BOOL)flag andVarArgs:(NSString *)format, ...

As always, code style is often a personal thing, and it ultimately comes down to one of two things:
1) What works best for you, or
2) If you're working with others, what everyone agrees is clearest.

-- Gwynne, key to the Code that runs us all
Formerly known as Sailor Quasar.
Email: email@hidden
Web: http://musicimage.plasticchicken.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Code style guidelines (From: Christoffer Lerno <email@hidden>)

  • Prev by Date: Code style guidelines
  • Next by Date: Re: Code style guidelines
  • Previous by thread: Code style guidelines
  • Next by thread: Re: Code style guidelines
  • Index(es):
    • Date
    • Thread