noCPPie
noCPPie

Reputation: 1

Does static initialization order fiasco apply to global variables without static?

i have some code example, in the function insert_id i got an empty string. After a lot of research it might be the initialization order fiasco, but i am not sure because the variable is only an const variable.

const std::string c_const_txt = "test string";


tc::tc()
{
    m_state_ok = false;
    std::cout << "date: " << __DATE__ << " time " << __TIME__ << std::endl
    m_id = insert_id(c_const_txt);
}

Could here happen the init order fiasco?

thanks

If i change the std::string to const char* i got the right string in the insert_id function.

Upvotes: 0

Views: 104

Answers (0)

Related Questions