Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 524463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:34:13+00:00 2026-05-13T08:34:13+00:00

I know that as of the C++03 standard, function-scope static initializations are not guaranteed

  • 0

I know that as of the C++03 standard, function-scope static initializations are not guaranteed to be thread safe:

void moo()
{
    static std::string cat("argent");  // not thread safe
    ...
}

With the C++0x standard finally providing standard thread support, are function-scope static initializations required to be thread safe?

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:34:14+00:00Added an answer on May 13, 2026 at 8:34 am

    it seems the initialization would be thread safe, since in the case the object is dynamically initialized upon entering the function, it’s guaranteed to be executed in a critical section:

    § 6.7 stmt.decl

    4. …such an object is initialized the first time control passes through its declaration… If control enters the declaration concurrently while the object is being initialized, the concurrent execution shall wait for completion of the initialization…

    there is a potential edge-case, if after returning from main(), the destructor of a static object calls the function after the static local has already destroyed, the behavior is undefined. however, that should be easy to avoid.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that there is a function in Java to set Standard Output Stream
I know that the C++ standard says (sec 9.4.2 paragraph 4) that a static
I know that in standard SQL you can do this: update top (100) table1
So we know that the standard doesn't force pointer sizes to be equal. (
I know that the C++ standard says that return 0 is inserted at the
I'm looking for a standard function that does this: def Forever(v): while True: yield
Google Spreadsheets currently does not support the standard function TDIST - i.e. the Student's
Does ntdll.dll come standard with windows XP and Windows Vista? I know that I
Take this code: using System; namespace OddThrow { class Program { static void Main(string[]
This is a purely theoretical question, I know that the standard containers interface are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.