• 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
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory Allocation


  • Subject: Re: Memory Allocation
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 16 Jul 2008 15:02:33 -0700

On Jul 16, 2008, at 14:19, Michael Ash wrote:

Can you explain this, in particular how the "standard" initializer
sets you up for fewer seriously subtle errors than this one?

It seems to me that the possible return values from the [super init]
call can be broken into three categories:

A) self
B) nil
C) Something Else


This has been discussed on this list fairly recently. The pattern:

	self = [super init...];

is both correct and required. See [NSManagedObject initWithEntity:insertIntoManagedObjectContext:] for an example of when the returned object is generally a different object.

There may be a couple of other cases where it matters, too (class clusters are NOT currently one of those other cases), but you should always assume initialization could return a different object or nil. (And that was the official word from Apple.)


_______________________________________________

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: 
 >Memory Allocation (From: "Alexandre Badez" <email@hidden>)
 >Re: Memory Allocation (From: "Kyle Sluder" <email@hidden>)
 >Re: Memory Allocation (From: "Michael Ash" <email@hidden>)

  • Prev by Date: Re: NSButton setKeyEquivalent doesn't seem to work
  • Next by Date: Re: MobileMe upload file to iDisk
  • Previous by thread: Re: Memory Allocation
  • Next by thread: Re: Memory Allocation
  • Index(es):
    • Date
    • Thread