Re: Using const strings
Re: Using const strings
- Subject: Re: Using const strings
- From: Clark Cox <email@hidden>
- Date: Wed, 22 Oct 2003 18:46:16 -0400
On Oct 22, 2003, at 16:47, 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?
Don't worry about it, it's perfectly safe to retain and release
constant strings (created with the @"" syntax or the CFSTR("") syntax)
--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html
_______________________________________________
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.