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

Re: observing dealloc


  • Subject: Re: observing dealloc
  • From: Jim Correia <email@hidden>
  • Date: Mon, 28 May 2007 16:29:04 -0400

On May 28, 2007, at 2:24 PM, Diederik Hoogenboom wrote:

The documentation says:

"The default implementation of this method retrieves the information from a global dictionary keyed by the receiver’s pointers.

For improved performance, this method can be overridden to retrieve the opaque data pointer in an instance variable. Overrides of this method must not attempt to send Objective-C messages to the stored data, including retain and release."

That's because it is opaque. It said everything but actually using the word opaque ;-). It is a void *. You don't know what it is. It might change from release to release. Not only can't you send objective-c messages to it in the override, you can't ever send objective-c messages to it (in shipping code) and expect it to be future proof.


So it doesn't say it's an opaque pointer. Just that you can override this method to return an opaque pointer.

void * is an opaque pointer. It is a pointer to something. That's all you know. If Apple wanted you to treat it as an array of dictionaries, it would be documented and prototyped that way.


These methods exist so that you can provide an implementation such as this for improved performance in cases where it matters. (Much like you can override retain/release/autorelease if you need to use a private retain count for improved performance.

@interface MyObject : NSObject {
	void * _myObservationInfo;
}
@end

@implementation

- (void)setObservationInfo:(void *)observationInfo
{
	_myObservationInfo = observationInfo;
}

- (void *)observationInfo
{
	return _myObservationInfo;
}

@end

Jim


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >observing dealloc (From: Ken Tozier <email@hidden>)
 >Re: observing dealloc (From: Jim Correia <email@hidden>)
 >Re: observing dealloc (From: Ken Tozier <email@hidden>)
 >Re: observing dealloc (From: Ken Tozier <email@hidden>)
 >Re: observing dealloc (From: Diederik Hoogenboom <email@hidden>)
 >Re: observing dealloc (From: Jim Correia <email@hidden>)
 >Re: observing dealloc (From: Diederik Hoogenboom <email@hidden>)

  • Prev by Date: Re: observing dealloc
  • Next by Date: Re: observing dealloc
  • Previous by thread: Re: observing dealloc
  • Next by thread: Re: observing dealloc
  • Index(es):
    • Date
    • Thread