Re: observing dealloc
Re: observing dealloc
- Subject: Re: observing dealloc
- From: Greg Titus <email@hidden>
- Date: Mon, 28 May 2007 17:42:46 -0700
On May 28, 2007, at 4:49 PM, Ken Tozier wrote:
On May 28, 2007, at 7:44 PM, Steve Israelson wrote:
What is wrong with having static variables in your class
implementation file?
Then use class methods to access em, and put any threading stuff
in there too.
You can even have a global to count how many object of your class
are created.
That's exactly what this does only in a standardized way. Maybe the
word "global" is confusing the issue. Perhaps I should have used
"static variable."
Personally, I wouldn't expect my static variables to lose their
values if there was a time when no instances existed. With your code,
if you create one MyObject, set "globals", dealloc your MyObject, and
then create a new MyObject, then the new instance will have the
"globals" unset again.
That may fit whatever your particular usage is, but if you are merely
looking for some other way of doing static variables, I'd do away
with the instance counter and dealloc method entirely, and simply let
the entries in the global dictionary exist for the life of the
application.
- Greg
_______________________________________________
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