• 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
[OT]Static Objects (was Re: STL set inside inside a class)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OT]Static Objects (was Re: STL set inside inside a class)


  • Subject: [OT]Static Objects (was Re: STL set inside inside a class)
  • From: "Duane Murphy" <email@hidden>
  • Date: Wed, 17 May 2006 17:05:00 -0700

Yeah, this is getting way off-topic.

--- At Wed, 17 May 2006 16:43:48 -0700, Paul Forgey wrote:

>> If
>> the object is static, then its initializer may not have been called
>> yet while some other static
>> object's initializer wants to call it; in this case review the link
>> order, or the order in which
>> the static objects appear if they're in the same file.
>
>My experience with any static object having a constructor is to just
>don't do it.

This is a broad brush stroke that has a solution that works quite well.

I agree that statics *at the file level* that have constructors are a
problem. The technique that we use is to have statics (with
constructors) inside of functions. The instantiation of the static is
controlled (and lazy) by calling the function.

That is static at the file level has problems (more than just with gcc).
static at the function level is quite useful.

 ...Duane


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

This email sent to email@hidden

References: 
 >STL set inside inside a class (From: mark <email@hidden>)
 >Re: STL set inside inside a class (From: Paul Forgey <email@hidden>)
 >Re: STL set inside inside a class (From: Jan Brittenson <email@hidden>)
 >Re: STL set inside inside a class (From: Paul Forgey <email@hidden>)

  • Prev by Date: Re: STL set inside inside a class
  • Next by Date: Re: STL set inside inside a class (sorry. Fixed)
  • Previous by thread: Re: STL set inside inside a class
  • Next by thread: Re: STL set inside inside a class
  • Index(es):
    • Date
    • Thread