Re: More memory allocation questions
Re: More memory allocation questions
- Subject: Re: More memory allocation questions
- From: Daniel Jalkut <email@hidden>
- Date: Tue, 30 Jul 2002 09:28:03 -0700
On Tuesday, July 30, 2002, at 06:25 AM, David Martin wrote:
In his book (Cocoa Programming for Mac OS X), Aaron Hillegass uses it
to initialize factory defaults -[NSUserDefaults registerDefaults:] or
for class versioning (-[NSObject setVersion:]).
Bye,
David
The importance of which is that since a class is sent a +initialize
message before it's used, it's an ideal place to do stuff that you'd
like done "as early as possible after the app is launched." Putting the
defaults registration in one of your top-level class's +initialize
routine means you don't have to worry about accidentally asking for a
user default somewhere before it's been set up.
Presumably it's done there instead of inside main() because all the
utility of NSApplicationMain has been done (setting up an autorelease
pool, etc.).
Daniel
_______________________________________________
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.