Re: Quick question! About init...
Re: Quick question! About init...
- Subject: Re: Quick question! About init...
- From: Charles Srstka <email@hidden>
- Date: Fri, 2 Aug 2002 18:41:19 -0500
Well, the first difference is that the second example won't compile -
you have too many left brackets. ;-)
The main difference between the two, though, is that the second example
is known as a "convenience constructor" and will return an autoreleased
object, while the first will return a retained object that you will need
to release manually later.
[NSString stringWithString:name];
is actually equivalent to:
[[[NSString alloc] initWithString:name] autorelease];
On Friday, August 2, 2002, at 06:31 PM, Ernst Persson wrote:
Is:
playerName[player] = [[NSString alloc] initWithString:name];
equal to:
playerName[player] = [[NSString stringWithString:name];
If not, what's the difference?
//ernie
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.