-(void)applicationDidFinishLaunching:(UIApplication *) app {
after UIApplication why is there a space before the asterisk?
thanks all.
-(void)applicationDidFinishLaunching:(UIApplication *) app {
after UIApplication why is there a space before the asterisk?
thanks all.
It's just a style preference, the space doesn't mean anything in this case.
It is, as has been remarked, just style; but it is generally considered good style to put the space before the asterisk, rather than after (i.e. NSString *aString;
rather than NSString* aString;
, as the asterisk binds to the name, rather than the type; ref. Steve's answer).
The same style is then generally extended to when the type stands alone, such as in - (NSString *) someMethod;
or - (void) someMethodWithAnArgument:(NSString *)argumentName;
, as a matter of staying consistent.
This is a characteristic from C code, I'm fairly new to Objective-C so forgive me if this isn't proper objective C syntax. It will answer the question. The answers about it being style are mostly correct with regard to a parameter such as given in the question. Where it is an issue is when declaring multiple variables on a single line in C or C++ (this is the part where I'm not sure if Obj-C supports this).
int* i;
and
int *i;
are equivalent; however when dealing with multiple declarations
int* i, j;
is not the same as
int *i, *j;
the * is applied to the i variable and not the int, thus you require an * on each variable you wish to make a pointer.
So the purpose of having the space after the class name is a stylistic nod to that.