I have just begun learning Objective-C, coming from a VB .Net and C# .Net background. I understand pointer usage, but in Objective-C examples I see the asterisk placed in s
1, 2 and 4 are equivalent and define a pointer to an NSString. My personal preference is to emulate K&R as much as possible, so I like to use NSString *string;
(NString*)string; though a valid statement, doesn't really do anything by itself.
$ cat foo.m
#include
void foo()
{
NSString *string;
(NSString*) string; // doesn't do anything
42; // doesn't do anything either
}
$ gcc -Wall -c foo.m
foo.m: In function 'foo':
foo.m:7: warning: statement with no effect
foo.m:8: warning: statement with no effect