• 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: Using const strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using const strings


  • Subject: Re: Using const strings
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Wed, 22 Oct 2003 22:20:22 +0100

On Wednesday, October 22, 2003, at 09:47 pm, Darrin Cardani wrote:

I'm working in Objective-C++, and it occurs to me that something I'm doing might not be a good idea. :-) I've done a few things like this in a header:

const CFStringRef someString = CFSTR ("blah");

Then later I do something like this:

NSArray* anArray = [ NSArray arrayWithObjects:(NSString*)someString, nil ];

or

NSDictionary* aDict = [ NSDictionary dictionaryWithObject:(NSString*)someString
andKey:someOtherString ];

Is this going to cause any problems when I release the array or dictionary? Can a const CFString have a retain count? Or is it marked in some special way that calling release doesn't do anything to it?

It works just fine. Don't worry about it.

Kind regards,

Alastair.
_______________________________________________
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: Using const strings
      • From: Daniel Hedrick <email@hidden>
References: 
 >Using const strings (From: Darrin Cardani <email@hidden>)

  • Prev by Date: Re: The cocoaBB has launched!!!
  • Next by Date: spinning indicator in Safari tabs
  • Previous by thread: Using const strings
  • Next by thread: Re: Using const strings
  • Index(es):
    • Date
    • Thread