Re: NSMutableData capacity
Re: NSMutableData capacity
- Subject: Re: NSMutableData capacity
- From: Jason Teagle <email@hidden>
- Date: Wed, 23 May 2012 20:15:52 +0100
- Organization: Organised Bytes Software
DO NOT DO THIS.
-init... is a one-time operation in Cocoa. The call is privileged to make
>destructive initializations to the object, to assume that its initial
state
>can be ignored, and even to replace the object entirely. Subsequent
-init...
calls will in turn assume they can make destructive initializations, and the
>object will almost certainly (maybe not today, maybe not tomorrow, but
soon,
>and for the rest of its life) break.
Fair point, and well noted. I think it's a shame that objects would be
so cavalier about their existing state (isn't that just sloppy? Makes it
far too easy to leak memory) but there *is* some logic to the whole
-initXXX thing being destructive and if that's the way it's done... so
be it. Glad I learned this now rather than *after* a problem...
--
Jason Teagle
_______________________________________________
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