Re: [OT] Re: [ANN] Cocoa Style for ObjC: 1 and 2
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