Months a go i found somthing like 'bug' in my code it is when turning
static DWORD processID = 0;
processID = GetCurrentProcessId();
into
static DWORD processID = GetCurrentProcessId();
my exe size jumped from 25k to 75k and I also noticed
slowdown of my game frame (from 3ms to 4ms) (though i still
do not know how it is possible (as this static initialization should
only appear once not each frame) and how to understand/explain it,
is this some cache efect appearing when exe bigges its size, got no idea)
there was answer
samoth,
"One notable difference of whether you compile C or C++ is for example that C++ (at least C++11, but GCC since ca. version 4.6 also does that for C++03) mandates initialization of function-local static variables being thread-safe. I'm mentioning that since you use that feature (maybe without being aware)."
if so I do understand that c++ language did that to can do static initializations
multithreading so i mean such kode like this
static int one = f1(); // potetntialy referencing and updating other data
static int two = f2();
static int three = f3();
static int four = f4();
can/will execute on many cores in parralel ? will main then wait untill the last one of initializing functions end it work? so it potentially could be used for
cheap form of multithreading?