Re: Need to release "constant objects"?
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.