cocoa touch - What's the convention on placing curly braces in Objective-C? -
cocoa touch - What's the convention on placing curly braces in Objective-C? -
i have seen different conventions objective-c (cocoa/cocoa touch) of placing curly braces.
the 2 have seen are:
- (void)dealloc { [super dealloc]; }
vs.
- (void) dealloc { [super dealloc]; }
this confuses me because expect such rather little community there should 1 convention.
which 1 of 2 more common?
i don't think there's canonical reply (whether speaking in terms of objective-c or other language). prefer:
- (void)dealloc { [super dealloc]; }
...but there lot of people prefer alternate style, well. more common, example code provided apple appears prefer first style (brace on same line), safe bet more mutual pattern. recall stumbling across older apple coding conventions document recommended sec style (brace on next line), (but recommended using 2 spaces instead of 4 indents, makes document garbage in opinion). might pick preference.
the thing recommend should never mix both styles in single source file. pick 1 , stick it. , if you're editing third-party source file uses 1 convention, follow same convention instead of using alternate format. @ to the lowest degree coding style consistent per compilation-unit.
objective-c cocoa-touch
Comments
Post a Comment