Re: [Q] is it shallow copy or deep copy? and why things are not retrieved well?
Re: [Q] is it shallow copy or deep copy? and why things are not retrieved well?
- Subject: Re: [Q] is it shallow copy or deep copy? and why things are not retrieved well?
- From: Fritz Anderson <email@hidden>
- Date: Wed, 20 Dec 2006 10:09:36 -0600
On 18 Dec 2006, at 1:45 AM, JongAm Park wrote:
I intentionally didn't release the string created with
CFStringCreateWithFormat, worrying if the
dictionaryWithObjectsAndKeys method does shallow copy.
...
So, can anyone tell me how the method keeps the content in the
"array", and why the value is not displayed?
It is well-documented that Cocoa collection objects retain their
values and copy their keys. See the general documentation for
NSDictionary. (I found this from Andy Lee's excellent Cocoa interface
browser AppKiDo, available at <http://homepage.mac.com/aglee/
downloads>.) Release the string after adding it to the dictionary
(unless you have an independent need for the nonreleased value).
As for the problem with the strings derived from encoding_constant
[i], have you used the debugger to step through your code and
examined encoding_constant[i] and the strings? This will involve
computing the strings outside the dictionary initialization, but may
make matters much clearer.
-- F
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden