• 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: [self init] vs. [super init] in initWithCoder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [self init] vs. [super init] in initWithCoder


  • Subject: Re: [self init] vs. [super init] in initWithCoder
  • From: glenn andreas <email@hidden>
  • Date: Sat, 19 Aug 2006 12:47:24 -0500


On Aug 19, 2006, at 11:41 AM, John McLaughlin wrote:

Hi Glenn,

You bring up a good point -- In my case I use Accessorizer extensively so I never, ever, set anything except through setters so I wouldn't leak (although it is arguable less efficient since you init an object that then immediately get's deallocated)

This is just designed to be a simple example showing why it can be bad to call init a second time - you just plain shouldn't call an initializer twice on the same object - see also the thread <http:// lists.apple.com/archives/cocoa-dev/2006/Jul/msg00475.html>.


Even if you make sure that all your code is safe to do this (even if you use accessors in Obj-C 2.0), you have no control over all the other code in the various frameworks that you use, so one should avoid getting into bad habits that will someday come back to bite you...


Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures, fractals, art



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >[self init] vs. [super init] in initWithCoder (From: John McLaughlin <email@hidden>)
 >Re: [self init] vs. [super init] in initWithCoder (From: Ricky Sharp <email@hidden>)
 >Re: [self init] vs. [super init] in initWithCoder (From: John McLaughlin <email@hidden>)
 >Re: [self init] vs. [super init] in initWithCoder (From: glenn andreas <email@hidden>)
 >Re: [self init] vs. [super init] in initWithCoder (From: John McLaughlin <email@hidden>)

  • Prev by Date: Re: Core Data attributes and reserved names...
  • Next by Date: Re: Core Data attributes and reserved names...
  • Previous by thread: Re: [self init] vs. [super init] in initWithCoder
  • Next by thread: Re: [self init] vs. [super init] in initWithCoder
  • Index(es):
    • Date
    • Thread