• 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: Struct, Object, or Dictionary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Struct, Object, or Dictionary?


  • Subject: Re: Struct, Object, or Dictionary?
  • From: Andy Lee <email@hidden>
  • Date: Wed, 2 Jul 2008 15:42:08 -0400

On Jul 1, 2008, at 2:36 PM, Andy Lee wrote:
The struct approach is bad because you can't actually do the memory management right in the general case. For example you can copy a struct using assignment -- myStructOne = myStruct2 -- and now you have increased the number of references to the strings inside the structs, but you haven't retaining those strings an extra time. Similarly if you pass a struct by value as an argument to a function or method.

For the record, I just realized this reasoning doesn't make sense. Your retain/release logic would be no more or less hairy than when you assign one pointer to another, or pass a pointer argument to a method or function.


Ignoring this mental lapse, I still say the object approach generally makes more sense.

--Andy


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: 
 >Struct, Object, or Dictionary? (From: "Bridger Maxwell" <email@hidden>)
 >Re: Struct, Object, or Dictionary? (From: Andy Lee <email@hidden>)

  • Prev by Date: Re: A question of style: Returning 'pairs'
  • Next by Date: Re: Problem with Cocoa on Java.
  • Previous by thread: Re: Struct, Object, or Dictionary?
  • Next by thread: Re: Struct, Object, or Dictionary?
  • Index(es):
    • Date
    • Thread