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 7877173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:17:39+00:00 2026-06-03T03:17:39+00:00

Help me understand this… see bold. From the Standard 3.6.3 Termination (2) 2 If

  • 0

Help me understand this… see bold. From the Standard 3.6.3 Termination (2)

2 If a function contains a block-scope object of static or thread
storage duration that has been destroyed and the function is called
during the destruction of an object with static or thread storage
duration, the program has undefined behavior if the flow of control
passes through the definition of the previously destroyed blockscope
object
. Likewise, the behavior is undefined if the block-scope object
is used indirectly (i.e., through a pointer) after its destruction.

Manager& GetManager()
{
    static Manager localMan;
    return localMan;
}

Then somewhere else…

{
   static User localUser;
   localUser.DoSomething(); //localUser calls GetManager and uses the reference returned.
}

Then in the User destructor…

User::~User()
{
   GetManager().DoSomethingOneLastTime();
}

//Now lets say Main exits and static destruction begins.
//Somehow localMan is destructed before User.
//Then user calls the GetManager() function in it's destructor.
//What case is this defined, and what case makes this undefined?

Is the standard saying that if the local static localMan object that was statically created with the odr-use rule was destructed, and then the function was called again (creating a new static or not) this is undefined? It looks like it leaves room for there is defined behavior, but if it passes through the definition of the destructed object it is not.

Anyone have clear insight on this?

  • 1 1 Answer
  • 0 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-06-03T03:17:41+00:00Added an answer on June 3, 2026 at 3:17 am

    I believe the key phrase here is

    creating a new static or not

    If this happens during destruction of static objects, and would cause a recreation of some of the already destroyed static objects, when would they then be destroyed? What if it causes a loop? How is the system supposed to be tracking all of this? Are the possible benefits worth the trouble?

    Probably not, as the language standard explicitly decides not to define this.

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

Sidebar

Related Questions

Please help me understand this recursive function... var stack = Array; function power(base, exponent){
Please help me. I can't understand why this function, that uses texture memory __global__
please help me understand this. You have a function that calls a few methods:
Please help me understand this. Here you can see that I have PYTHONPATH set
Hi could anybody help me understand this particular piece of code from this Langton's
Could someone help me understand the primitive accessors with this example : i don't
I cannot understand how this is possible. Please help!! I have an app with
To help me better understand lambda I wrote this short snippet that rotates and
I created an ExpandableListView with the help of this tutorial: link . I understand
Help me understand this; I'm learning Sinatra (and Rails for that matter, er, and

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.