On Fri, Jun 20, 2008 at 9:11 PM, Brian Norwood <[EMAIL PROTECTED]> wrote:
> NSString *stuff = [NSString stringWithString:otherStuff];
>
> or
>
> NSString *stuff = [[NSString alloc] initWithString:otherStuff];

Those aren't equivalent statements, unless you're running under
garbage collection.

> The question is this: is there an advantage to one over the other, and why?
> If so, is this something I should determine on a case by case basis? Is
> +stringWithString: just a shortcut for +alloc and -initWithString:?

It's a shortcut for [[[NSString alloc] initWithString:aString] autorelease].
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to