Skip navigation.
 
mlRe: [self init] vs. [super init] in initWithCoder
FROM : glenn andreas
DATE : Sat Aug 19 19:47:24 2006

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_removed>
  <http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate  | images, textures, 
fractals, art

Related mailsAuthorDate
ml[self init] vs. [super init] in initWithCoder John McLaughlin Aug 18, 05:26
mlRe: [self init] vs. [super init] in initWithCoder Greg Hurrell Aug 18, 05:39
mlRe: [self init] vs. [super init] in initWithCoder Ricky Sharp Aug 18, 05:42
mlRe: [self init] vs. [super init] in initWithCoder Byron Wright Aug 18, 07:45
mlRe: [self init] vs. [super init] in initWithCoder Jim Correia Aug 18, 13:50
mlRe: [self init] vs. [super init] in initWithCoder John McLaughlin Aug 18, 21:53
mlRe: [self init] vs. [super init] in initWithCoder glenn andreas Aug 18, 22:09
mlRe: Re: [self init] vs. [super init] in initWithCoder Shawn Erickson Aug 18, 23:12
mlRe: [self init] vs. [super init] in initWithCoder John McLaughlin Aug 19, 18:41
mlRe: [self init] vs. [super init] in initWithCoder glenn andreas Aug 19, 19:47
mlRe: [self init] vs. [super init] in initWithCoder Jim Correia Aug 19, 23:14
mlRe: [self init] vs. [super init] in initWithCoder John McLaughlin Aug 20, 04:58