static-order-fiasco Questions
2
Solved
I was told to use the singleton pattern instead of having global objects, which have the “static” storage duration, to avoid the static initialization order fiasco. But now that I have C++20 module...
Paloma asked 9/3, 2024 at 6:37
4
Solved
Once I was reading an awesome C++ FAQ (It is really good!!) and read the topic about how to prevent the static initialization order "fiasco". So the author advises to wrap the static variables into...
Willing asked 23/4, 2015 at 11:32
12
We've run into some problems with the static initialization order fiasco, and I'm looking for ways to comb through a whole lot of code to find possible occurrences. Any suggestions on how to do thi...
Acapulco asked 2/12, 2008 at 20:40
1
Solved
I'm trying to understand the sequencing rules for initialization and destruction of namespace-scope and block-scope objects with static storage duration and thread-local storage duration in the con...
Bathsheb asked 1/1, 2019 at 23:52
1
Solved
According to C++11 specification:
The results of including <iostream> in a translation unit shall be as if <iostream> defined an instance of ios_base::Init with static storage durat...
Hickory asked 20/10, 2016 at 16:34
1
Solved
May this global function suffer from static initialization fiasco?
template <typename TFn>
void ParallelFor(int iIni,int iFin,TFn Fn)
{
static const unsigned int NThread= std::thread::hard...
Currant asked 6/6, 2016 at 6:38
6
Solved
When I use static variables in C++, I often end up wanting to initialize one variable passing another to its constructor. In other words, I want to create static instances that depend on each other...
Unbeatable asked 17/6, 2009 at 8:0
2
Solved
I had a discussion this morning with a colleague about static variable initialization order. He mentioned the Nifty/Schwarz counter and I'm (sort of) puzzled. I understand how it works, but I'm not...
Velarium asked 11/4, 2011 at 14:14
5
Solved
In his "Thinking in C++" (Chapter 10) Eckel describes a technique that was pioneered by Jerry Schwarz to solve the fiasco.
He says that if we want to initialize x to 100 and y to 200 and share the...
Umbilication asked 14/3, 2011 at 13:19
11
Solved
A recent question here had the following code (well, similar to this) to implement a singleton without synchronisation.
public class Singleton {
private Singleton() {}
private static class Singl...
Chiropractor asked 7/7, 2011 at 6:31
2
Solved
I have a program split up into two source files:
example.cpp
#include <iostream>
class A {
public:
A(int x) {
::std::cout << "In A(" << x << ")\n";
}
};
static A fir...
Mingrelian asked 10/11, 2011 at 23:24
2
Solved
Lets say that we have two compilation units as follows:
// a.cpp
extern int value2;
int value1 = value2 + 10;
// b.cpp
extern int value1;
int value2 = value1 + 10;
When I tried it on VC2010, it...
Shanly asked 13/5, 2011 at 2:28
3
Solved
There are a few good questions and answers here around the "static initialization order fiasco", but I seem to have hit against yet another expression of it, specially ugly because it does not cras...
Longford asked 24/3, 2011 at 16:46
4
Solved
I was reading about SIOF from a book and it gave an example :
//file1.cpp
extern int y;
int x=y+1;
//file2.cpp
extern int x;
int y=x+1;
Now My question is :
In above code, will following thin...
Heraldry asked 14/6, 2010 at 6:47
2
Solved
I have next situation: I need to create widget in standalone static library, which then will be linked with final application (visual c++ 9.0, qt 4.5).
This static widget library contains some reso...
Manthei asked 8/9, 2009 at 9:7
1
© 2022 - 2025 — McMap. All rights reserved.