On objective-c with iPhone:
I want to make a append with strings, but can I use autorelease? Is this right?
NSString *str1 = [[NSString alloc] initWithString:@"STR1"]; NSString *str2 = [[NSString alloc] initWithString:@"STR2"]; NSString *s = [[str1 autorelease] stringByAppendingString:[str2 autorelease]];
will this remove the *str1 and *str2 memory?
And for example, if I have a method:
+(void) doSomething { NSString *str1 = [[NSString alloc] initWithString:@"STR1"]; NSString *str2 = [[NSString alloc] initWithString:@"STR2"]; NSString *s = [[str1 autorelease] stringByAppendingString:[str2 autorelease]]; [[NSClassFromString(s) alloc] init]; }
should I dealloc the *s pointer???