• 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: singleton design pattern
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: singleton design pattern


  • Subject: Re: singleton design pattern
  • From: Alastair Houghton <email@hidden>
  • Date: Wed, 19 May 2010 10:02:12 +0100

On 18 May 2010, at 23:58, Abhinay Kartik Reddyreddy wrote:

> 	static NSMutableDictionary* uniqueInstance = nil;
> // the static variable has to be initialized before  you enter the uniqueInstance method.

Not true.  Static variables are initialised to nil (or zero) automatically (it says so in the C standard, §5.1.2 - "All objects with static storage duration shall be initialized (set to their initial values) before program startup.").  Further, it's entirely acceptable to write the static variable declaration inside the +uniqueInstance method... that controls the scope of the variable name, not its lifetime (which was already defined by the use of the "static" keyword).

Neither of those things are the problem... as Mike says, we'd need a stack backtrace to see where the problem lies, and it doesn't look as if it's in this method.

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: 
 >singleton design pattern (From: Alejandro Marcos Aragón <email@hidden>)
 >Re: singleton design pattern (From: Mike Abdullah <email@hidden>)
 >Re: singleton design pattern (From: Abhinay Kartik Reddyreddy <email@hidden>)

  • Prev by Date: Re: Regarding MVC design pattern
  • Next by Date: Re: Regarding MVC design pattern
  • Previous by thread: Re: singleton design pattern
  • Next by thread: Re: singleton design pattern
  • Index(es):
    • Date
    • Thread