• 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: [OT] Re: [ANN] Cocoa Style for ObjC: 1 and 2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT] Re: [ANN] Cocoa Style for ObjC: 1 and 2


  • Subject: Re: [OT] Re: [ANN] Cocoa Style for ObjC: 1 and 2
  • From: Adrian Bool <email@hidden>
  • Date: Wed, 27 Oct 2004 09:49:23 +0200 (CEST)


Greetings Graham!

Hope you are well ;-)

Need to agree with Apple on the pointers,

varname* fred, wilma ;

Looks like it will create two varname pointers where in fact you naturally would get one varname pointer and one varname. Keeping the stars with the variables then fits better,

varname *fred, *wilma ;

For your two pointers.

I too hate such curly bracket placement in Apple's script.. Although I prefer to indent the brackets - but that seems to be just me and the author of exim AFAIR * ;-)

- (void) foo: (NSWhatever*) bar
{
varname *foobar;

// do stuff
}

Cheers,

aid

* Phil Hazel

On Wed, 27 Oct 2004, Graham cox wrote:


On 27/10/2004, at 12:24 PM, Keith Anderson wrote:

Programmers on other platforms are probably wondering how we have time to think about this stuff. :)

That one made it to my motd file!


yep, a priceless comment :)


On the subject of style, and at the risk of opening a can of worms (god forbid), can anyone explain to me why in many of the example code Apple supplies, it has style like this:

-(void)foo:(NSWhatever *)bar{
varname *foobar;
//do stuff
}


as opposed to what I have always done which is this:


- (void) foo: (NSWhatever*) bar
{
varname* foobar;

// do stuff
}


There are lots of small style diffs here, many probably just a matter of personal preference, particularly with associativity of the * operator. (I hope they show up as intended on your mail client). But since whitespace adds readability in spades yet has zero impact on performance (maybe a very minor one on compile time), I have never really 'got' the crunched up compacted coding style that many seem to favour.

But if there's a compelling reason I've just not thought of, I'd love to hear it!

--Graham

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: [OT] Re: [ANN] Cocoa Style for ObjC: 1 and 2
      • From: Graham cox <email@hidden>
References: 
 >[ANN] Cocoa Style for ObjC: 1 and 2 (From: Scott Stevenson <email@hidden>)
 >Re: [ANN] Cocoa Style for ObjC: 1 and 2 (From: Marco Scheurer <email@hidden>)
 >Re: [ANN] Cocoa Style for ObjC: 1 and 2 (From: Scott Stevenson <email@hidden>)
 >Re: [ANN] Cocoa Style for ObjC: 1 and 2 (From: Keith Anderson <email@hidden>)
 >[OT] Re: [ANN] Cocoa Style for ObjC: 1 and 2 (From: Graham cox <email@hidden>)

  • Prev by Date: Re: [OT] Re: [ANN] Cocoa Style for ObjC: 1 and 2
  • Next by Date: 2-D functional equiv. to NSTableView?
  • Previous by thread: Re: [OT] Re: [ANN] Cocoa Style for ObjC: 1 and 2
  • Next by thread: Re: [OT] Re: [ANN] Cocoa Style for ObjC: 1 and 2
  • Index(es):
    • Date
    • Thread