Re: What's so special about NSString literals? (RE: memory management)
Re: What's so special about NSString literals? (RE: memory management)
- Subject: Re: What's so special about NSString literals? (RE: memory management)
- From: Bill Bumgarner <email@hidden>
- Date: Wed, 17 May 2006 20:22:36 -0700
On May 17, 2006, at 7:56 PM, Eric wrote:
Are strings defined as NSString *string = [NSString
stringWithFormat...]
constants as well? I mean, they are certainly immutable, but I'm
not sure
if it's in the same class as string literals. If they are the same,
doesn't that mean I don't have to worry about releasing manually
allocated
NSString like "string" as well?
There is no way a method invocation could result in something that can
be treated as a constant. Methods are dynamically dispatched. There
is absolutely no way to guarantee that the method's implementation is
the same at runtime as it was at compile time.
This....
NSString *foo = @"string";
... is completely different than this....
NSString *foo = [NSString stringWithString: @"string"];
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden