Skip navigation.
 
mlRe: Struct, Object, or Dictionary?
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

Related mailsAuthorDate
mlStruct, Object, or Dictionary? Bridger Maxwell Jul 1, 19:53
mlRe: Struct, Object, or Dictionary? James Bucanek Jul 1, 20:18
mlRe: Struct, Object, or Dictionary? Keary Suska Jul 1, 20:30
mlRe: Struct, Object, or Dictionary? Andy Lee Jul 1, 20:36
mlRe: Struct, Object, or Dictionary? Bridger Maxwell Jul 1, 20:41
mlRe: Struct, Object, or Dictionary? lbland Jul 1, 20:45
mlRe: Struct, Object, or Dictionary? Andy Lee Jul 2, 21:42
mlRe: Struct, Object, or Dictionary? mmalc Crawford Jul 3, 02:33