Hi Bill,

On Mon, Jan 19, 2009 at 3:21 PM, Bill Bumgarner <[email protected]> wrote:

> foo = @""; // foo is a reference to the empty string
> foo = [[NSString alloc] init]; // foo is a reference to the empty string
>
> The second is retained.  The first is not.  The first is a constant string
> and, thus, -retain/-release is a no-op.  An implementation detail to ignore:
>
> foo = [@"" retain];

Are you sure about that? My understanding is that the second case ends
up pointing to a constant string and that retain and release are also
no-ops in that case.

Also, if I remember rightly, that in the first case you'll end up
pointing to a constant in the current translation unit, whereas in the
second case you end up pointing to a global constant defined in
CoreFoundation. Implementation details, I know.

Regards,

Chris
_______________________________________________

Cocoa-dev mailing list ([email protected])

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