• 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: Multiple singletons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple singletons


  • Subject: Re: Multiple singletons
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 27 Jun 2005 23:16:19 +0200


On 27.6.2005, at 21:55, Daniel Jalkut wrote:

One thing worth noting with regard to singletons: always use a "static global" for the singleton variable

Definitely. Whenever possible (ie., not accessed from more methods), it's cleaner to declare the variable inside a method anyway:


+(X*)singleton {
  static X *singleton=nil;
  if (!singleton) ... yadda yadda yadda
}
---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Multiple singletons (From: Ken Tozier <email@hidden>)
 >Re: Multiple singletons (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Re: Multiple singletons
  • Next by Date: Re: Convert PICT to NSImage
  • Previous by thread: Re: Multiple singletons
  • Next by thread: Re: Multiple singletons
  • Index(es):
    • Date
    • Thread