• 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: [Q] is it shallow copy or deep copy? and why things are not retrieved well?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >[Q] is it shallow copy or deep copy? and why things are not retrieved well? (From: JongAm Park <email@hidden>)

  • Prev by Date: Drawing elliptical curve using NSBezierPath
  • Next by Date: Re: Drawing elliptical curve using NSBezierPath
  • Previous by thread: [Q] is it shallow copy or deep copy? and why things are not retrieved well?
  • Next by thread: Re: [Q] is it shallow copy or deep copy? and why things are not retrieved well?
  • Index(es):
    • Date
    • Thread