Is it a good practice to declare a vector as global in C++?
This is what I did.
#include <vector>
std::vector<int> vec;
My program compiles successfully, but I am not sure whether this could lead to a runtime error under certain circumstances. According to my understanding, the memory for a global variable will be allocated at compile time, and the compiler may reserve a limited amount of memory to which this vector can expand. Upon hitting this limit, what is being written can eat into the memory used by another variable.
Please advise.