Is global memory initialized in C++? -


is global memory initialized in c++? , if so, how?

(second) clarification:

when program starts up, in memory space become global memory, prior primitives being initialized? i'm trying understand if zeroed out, or garbage example.

the situation is: can singleton reference set - via instance() call, prior initialization:

mysingleton* mysingleton::_instance = null; 

and 2 singleton instances result?

see c++ quiz on on multiple instances of singleton...

yes global primitives initialized null.

example:

int x;  int main(int argc, char**argv) {   assert(x == 0);   int y;   //assert(y == 0); <-- wrong can't assume this. } 

you cannot make assumptions classes, structs, arrays, blocks of memory on heap...

it's safest initialize everything.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -