• 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: "M. Uli Kusterer" <email@hidden>
  • Date: Wed, 27 Oct 2004 15:08:05 +0200

At 0:49 Uhr -0700 27.10.2004, Steve Checkoway wrote:
One problem with doing the
int* foo;
is it can byte you if you try to do
int* foo, bar;
and expect that you have two pointers to integers. I have seen experienced programmers get bitten by that.

My summary is the following:

type* ptr = &myVar,
ptr2;

DANGER! ptr2 is type, not type*.

type *ptr = &myVar,
*ptr2;

Looks like it was dereferencing ptr. Especially misleading when type is a pointer type by itself already (like "id").

IMHO the best way to write this (though I have to admit I haven't broken the habit of using the first variation yet) is:

type * ptr,
* ptr2;

because it is a compromise between the above two, which is also conceptually true, because the asterisk, while more closely qualifying the type, actually belongs to the variable.

Too bad they didn't fix that early on in C...
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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
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>)
 >Re: [OT] Re: [ANN] Cocoa Style for ObjC: 1 and 2 (From: Steve Checkoway <email@hidden>)

  • Prev by Date: Re: Cocoa Java futures, NDA's etc
  • Next by Date: Re: [NEWBIE] How to send an email with Cocoa?
  • 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