New++, the initialization of globals in a single translation unit, ie., a .cpp file with all the defines preprocessed, is defined, the globals defined first are initialized first. (You can always depend on the 0 initialization.) But for globals spanning multiple files, the initialization order is undefined, usually depending on the order of the files given to the linker, meaning even if the C++ standard defined an initialization order, the order of initialization would be useless for practical purposes. Further, there are easy to use techniques using a function like
Code:
int getI()
{
static int i = 4;
return i;
}
When this function is called, even from a global context, the variable i is automatically initialized.