• 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: 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


References: 
 >Re: observing dealloc (From: Erik Buck <email@hidden>)
 >Re: observing dealloc (From: Ken Tozier <email@hidden>)
 >Re: observing dealloc (From: Steve Israelson <email@hidden>)
 >Re: observing dealloc (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: observing dealloc
  • Next by Date: cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386
  • Previous by thread: Re: observing dealloc
  • Next by thread: Re: observing dealloc
  • Index(es):
    • Date
    • Thread