• 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: Memory allocation issues with NSObject and NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory allocation issues with NSObject and NSString


  • Subject: Re: Memory allocation issues with NSObject and NSString
  • From: glenn andreas <email@hidden>
  • Date: Tue, 20 Jan 2009 09:07:47 -0600


On Jan 19, 2009, at 11:04 PM, Michael Ash wrote:

I maintain that NSObject -init is guaranteed to do nothing, and
changing this fact would seriously break the API contract.


I read it that it does nothing to initialize the object (since the object has nothing that needs to be initialized). That doesn't preclude that it may not do something debugging related book keeping, for example.

But even if it does nothing what so ever, you still can't skip calling it. The documentation is quite clear that you need to do [super init] (or another init method) regardless:

"Subclass versions of init need to incorporate the initialization code for the classes they inherit from, through a message to super"

So even though it is contracted to do nothing, subclass inits are contracted that they need to call super.


Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! Mad, Bad, and Dangerous to Know

_______________________________________________

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


References: 
 >Re: Memory allocation issues with NSObject and NSString (From: Ben Trumbull <email@hidden>)
 >Re: Memory allocation issues with NSObject and NSString (From: Michael Ash <email@hidden>)

  • Prev by Date: Getting iPod icon, was Getting the network Machine Icon
  • Next by Date: Re: CoreData entity mutability
  • Previous by thread: Re: Memory allocation issues with NSObject and NSString
  • Next by thread: Having issues using NSAttribute strings with link Attribute ..
  • Index(es):
    • Date
    • Thread