Graham Cox wrote:
On 16/10/2009, at 11:54 AM, Frederick C. Lee wrote:
Both seem to work the same.
Is there any benefit of (1) over (2) or is it merely style of
programming?
(1) isn't really an alternative way of implementing a method, it's just
that the trailing semicolon is ignored. I'm not even sure if it's
deliberately allowed (it wouldn't be for a C function) or merely an
artifact of the way Obj-C is parsed.
-(void) foo
{
}
and
- (void) foo {
}
are both perfectly valid ways of defining any block in C and always
have been (though I personally abhor the second style yet seem to be
ploughing my own furrow on that one - almost everyone uses it :(
I'm ploughing it with you, I hate it too and spend 30 seconds every time
I let XCode stub out a function for me moving the brace onto the correct
line, andputtingspacesbackbetweenparanetheses,bracketsandarguments so I
have a hope in hell of reading the code later.
I came across that trailing ';' thing the other day purely by accident
and couldn't believe my code actually worked.
I think I'll take this over to XCode and ask about it.
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com