Re: Status of @"" strings
Re: Status of @"" strings
- Subject: Re: Status of @"" strings
- From: Bill Cheeseman <email@hidden>
- Date: Thu, 12 Jul 2001 07:55:19 -0400
on 7/12/01 3:58 AM, Andreas Monitzer at email@hidden wrote:
>
On Thursday, July 12, 2001, at 09:27 , Rob Rix wrote:
>
>
> This has been bothering me for a while now...
>
>
>
> What is the status of strings in your code that have been created using
>
> the @"" shorthand? It's shorthand for creating an NSString instance, yes
>
> (I seem to recall reading that, and also I seem to recall sample code
>
> somewhere that had an @"" string as the receiver of a message)? Is it
>
> autoreleased?
>
>
No, @"" doesn't create an instance, just like "" doesn't allocate memory.
>
Both are stored in the code part of the app, so they're loaded when the
>
code loads and free'd when the code is removed from memory. retain,
>
release and autorelease is ignored by @"".
So, if you want to have a temporary empty string that you CAN release so
that it won't hang around in the code for the life of the app, is this
preferred? --
NSString *emptyString = [[NSString alloc] init];
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
The AppleScript Sourcebook - www.AppleScriptSourcebook.com
Vermont Recipes - www.stepwise.com/Articles/VermontRecipes