• 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: Bill Bumgarner <email@hidden>
  • Date: Sun, 18 Jan 2009 23:36:46 -0800

On Jan 18, 2009, at 9:05 PM, Michael Ash wrote:
For now. Someday, that might change.

I sure hope not! The documentation for the method states:

"The init method defined in the NSObject class does no initialization;
it simply returns self."

Making it do anything else would be a serious breach of the API contract.

However I strongly advocate calling it anyway, as it makes your code
more robust if you change the superclass later on to something that
really does do something in init.

Exactly

I didn't say *who* might change it!

It is quite common to....

- create a subclass of NSObject

- create another subclass of NSObject

- realize that A and B have a bit in common...

- ... and create a common superclass from which A and B can share functionality

By following the rules with consistency throughout your code, you minimize the pain of maintenance and transmogrification over time.

b.bum

_______________________________________________

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: Memory allocation issues with NSObject and NSString
      • From: Michael Ash <email@hidden>
References: 
 >Memory allocation issues with NSObject and NSString (From: "Devraj Mukherjee" <email@hidden>)
 >Re: Memory allocation issues with NSObject and NSString (From: Bill Bumgarner <email@hidden>)
 >Re: Memory allocation issues with NSObject and NSString (From: Michael Ash <email@hidden>)

  • Prev by Date: Re: Dealing with exceptions in a drawing stack
  • Next by Date: Re: Migration with abstract entities
  • Previous by thread: Re: Memory allocation issues with NSObject and NSString
  • Next by thread: Re: Memory allocation issues with NSObject and NSString
  • Index(es):
    • Date
    • Thread