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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:26:48+00:00 2026-05-19T09:26:48+00:00

I read about the SIOF in the faq-lite and still I really don’t understand

  • 0

I read about the SIOF in the faq-lite and still I really don’t understand why the issue happens. I have a static library(.a) and I use that library to use its static const data member object type. Then that static const data member object type I use and assign to a global variable(object). But it seems that global variable is empty when I use that global variable to my main or to any local function. I know obviously that my issue is SIOF but I really don’t understand why my static const data member object was not initialized.

It was static library so I guess when we created our static library the static const data member object was compiled and linked to that static library, correct me if I’m wrong..

//libsource.h
class foo
{
   public:
   ....

   public:
   static const barbar foofaa;
};

//libsource.cpp
const barbar foo::foofaa = barbar();

//main.cpp
#include <libsource.h>

barbar foos= foo::foofaa;

int main()
{
   //can't use foos because its empty
}

Please advice. Why that static const data member object was not initialized even if its in the static library?

Many thanks.

  • 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-05-19T09:26:49+00:00Added an answer on May 19, 2026 at 9:26 am

    The static initialization order fiasco is fairly straightforward: static objects in a single translation unit are initialized in the order in which they are declared, but there is no guarantee as to the order in which static objects in different translation units are initialized with respect to each other.

    So, in your specific example, foos in main.cpp may be initialized before foo::foofaa, which is declared in libsource.cpp.

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

Sidebar

Related Questions

Read about the issue in this stackoverflow question . Still have the same issue
I read about Change the delegate of MGTwitterEngine and don't really get it. I
I read about skipList implementation in C++ and I don't understand this random function
I read about 'side effect' from this website : but still not understand why
I read about JSON from internet but still i have not got the grasp
I read about child actions in MVC (fundamental book), but I don't really know
I read about HTTP persistent connection but somehow I don't seem to understand what
Read about Fog: http://fog.io Does Python have anything like it? (a library for cloud
Read about the z-index issue and tried anything, but just can't seem to fix
I read about templated controls/INamingContainer but I can't understand what problem it solves when

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.