FROM : Andy Lee
DATE : Wed Jul 02 21:42:08 2008
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
DATE : Wed Jul 02 21:42:08 2008
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
| Related mails | Author | Date |
|---|---|---|
| Bridger Maxwell | Jul 1, 19:53 | |
| James Bucanek | Jul 1, 20:18 | |
| Keary Suska | Jul 1, 20:30 | |
| Andy Lee | Jul 1, 20:36 | |
| Bridger Maxwell | Jul 1, 20:41 | |
| lbland | Jul 1, 20:45 | |
| Andy Lee | Jul 2, 21:42 | |
| mmalc Crawford | Jul 3, 02:33 |






Cocoa mail archive

