• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMutableData capacity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSMutableData capacity
      • From: Jens Alfke <email@hidden>
References: 
 >NSMutableData capacity (From: Andreas Grosam <email@hidden>)
 >Re: NSMutableData capacity (From: Jason Teagle <email@hidden>)
 >Re: NSMutableData capacity (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: NSMutableData capacity
  • Next by Date: Re: NSMutableData capacity
  • Previous by thread: Re: NSMutableData capacity
  • Next by thread: Re: NSMutableData capacity
  • Index(es):
    • Date
    • Thread