• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: "Constant" strings are static or autoreleased?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Constant" strings are static or autoreleased?


  • Subject: Re: "Constant" strings are static or autoreleased?
  • From: sinclair44 <email@hidden>
  • Date: Wed, 05 Mar 2003 15:23:25 -0500

On 3/5/03 2:51 PM, "zauhar" <email@hidden> wrote:

> In reply to Britt's questions, one of you said that strings created
> with the "@" are autoreleased, and David said
>
>> True. Those are static strings created for you when the program
> launches. They can never be released or modified.
>
> Which is it? I would think that David's answer is correct.
>
> Randy

Doing

NSString *myString = @"string";

Is the same as

NSString *myString = [NSString stringWithCString:"string"];

In both cases, myString is an autoreleased, *immutable* instance of
NSString.
--

-- sinclair44

[self becomeWorldDictator];

- (void)becomeWorldDictator
{
[[world currentLeaders] assassinate];
[[world citizens] terrorize];
[world setCurrentLeaders:[NSArray arrayWithObject:self]];
}
_______________________________________________
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.

  • Follow-Ups:
    • Re: "Constant" strings are static or autoreleased?
      • From: Lance Bland <email@hidden>
References: 
 >"Constant" strings are static or autoreleased? (From: zauhar <email@hidden>)

  • Prev by Date: Fwd: A weird Preview problem
  • Next by Date: Re: Getting information about volumes
  • Previous by thread: "Constant" strings are static or autoreleased?
  • Next by thread: Re: "Constant" strings are static or autoreleased?
  • Index(es):
    • Date
    • Thread