• 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: Abhinay Kartik Reddyreddy <email@hidden>
  • Date: Wed, 19 May 2010 18:45:43 -0400

Thanks GG.

Apologies for the wrong remark.

On May 19, 2010, at 6:33 PM, Greg Guerin wrote:

> Abhinay Kartik Reddyreddy wrote:
>
>> everytime you ask for a uniqueInstance it looks like it retrieves a new instance not the existing instance... since you set the uniqueinstance to nil inside that function, your function will discard the previous instance if any and then create a new instance. Singleton is supposed to return existing instance if any and if none create one.
>>
>> Also i guess the scope of your static is local.
>>
>> correct me if i am wrong.
>
>
> Your assertion that a new instance is created every time is wrong.  It would be right if the storage class were anything but static.  But it is static.  So a new instance is created only once, barring any thread-unsafe artifacts.
>
> By the way, this is true for plain ordinary standard C.  Objective-C does not change it.
>
>  -- GG
>
> _______________________________________________
>
> 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

_______________________________________________

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: 
 >Re: singleton design pattern (From: Greg Guerin <email@hidden>)

  • Prev by Date: Re: singleton design pattern
  • Next by Date: Re: Original iPhone animation performance
  • Previous by thread: Re: singleton design pattern
  • Next by thread: Get controller from nib
  • Index(es):
    • Date
    • Thread