Re: Struct, Object, or Dictionary?
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