NSMutableArray contract
NSMutableArray contract
- Subject: NSMutableArray contract
- From: Carlos Eduardo Mello <email@hidden>
- Date: Fri, 01 Apr 2011 10:29:01 -0300
Hi people,
I just realized I may be doing something dangerous with an
NSMutableArray. I searched Guides and References on this but couldn't
find an explicit answer:
- Does an NSMutableArray guarantee to retain an object on addObject:?
- Does it ever make a copy of the original instead of retaining it?
- As long as I am sure the object will not be removed (or replaced)
from the array, is it safe to assume that the object I passed to
addObject: is the exact same object inside the array?
The reason I am asking this is because in a couple of hard-to-debug
places in my code I use an object I just added to a mutable array
counting on it being the same pointer as inside the array (because
other parts of the code will need it there later).
Thanks in advance for any help. (hopefully I'll get more proficient
with cocoa soon enough, so I won't have to bother you guys so much...)
Carlos.
_______________________________________________
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