• 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: Need to release "constant objects"?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need to release "constant objects"?


  • Subject: Re: Need to release "constant objects"?
  • From: mmalcolm crawford <email@hidden>
  • Date: Sat, 8 May 2004 01:01:25 -0700

On May 8, 2004, at 12:31 AM, Eric Wang wrote:

You probably shouldn't be initializing your constants in the class' -init
method. Your constant initialization methods will be called unnecessarily
each time you create a new instance of the class. Instead, do your constant
initialization in the +initialize class method, which works like a static
initializer in Java. It will be called only once, when the class is loaded.
Unfortunately, this practice is nowhere to be found in Apple's developer
documentation.

This turns out not to be the case:
<http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ 3objc_language_overview/chapter_3_section_4.html>
"Variables and Class Objects" and "Initializing a Class Object"

The use of +initialize for initialization is mentioned elsewhere besides.

mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Need to release "constant objects"? (From: Eric Wang <email@hidden>)

  • Prev by Date: Re: Need to release "constant objects"?
  • Next by Date: Screensavers, NSXMLParser, "Test" and lockups.
  • Previous by thread: Re: Need to release "constant objects"?
  • Next by thread: Is NSAppleScript thread-safe?
  • Index(es):
    • Date
    • Thread