(UIApplication *) Why is there a space before an asterisk?

-(void)applicationDidFinishLaunching:(UIApplication *) app {

after UIApplication, why is there a space before the asterisk?

+3
source share
4 answers

This is a feature from C code , I'm fairly new to Objective-C, so forgive me if this is the wrong target for C syntax. He will answer the question. Answers that this is a style are mostly correct with respect to a parameter such as the one asked in the question. Where the problem is, it is declaring several variables on the same line in C or C ++ (this is the part where I'm not sure if Obj-C supports it).

int* i;

and

int *i;

are equivalent; however, when working with multiple ads

int* i, j;

does not match

int *i, *j;

* i, int, * , .

, .

+10

, , ; , , (.. NSString *aString;, NSString* aString;, , , ).

, , , - (NSString *) someMethod; - (void) someMethodWithAnArgument:(NSString *)argumentName;, .

+7

, .

+5

Actually, int *i; int* i;and (int *) i; all mean different things. The first two are pointers. But the latter actually says that "i" returns a pointer to an int. So in:

-(void)applicationDidFinishLaunching:(UIApplication *) app {

This actually means that the "application" returns a pointer

0
source

Source: https://habr.com/ru/post/1768506/


All Articles