• 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: More memory allocation questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: More memory allocation questions (From: David Martin <email@hidden>)

  • Prev by Date: Re: Knowing when window closed
  • Next by Date: Re: Referencing files in the app's bundle
  • Previous by thread: Re: More memory allocation questions
  • Next by thread: Re: More memory allocation questions
  • Index(es):
    • Date
    • Thread