Going by the document here http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2011/n3242.pdf
“Variables with static storage duration (3.7.1) or thread storage duration (3.7.2) shall be zero-initialized (8.5) before any other initialization takes place”
If I have everything, i.e class declaration and main() in a single file (a must) I should be able to omit the initialization. But, if I omit, I get "undefined reference" error during build.
#include <iostream>
using namespace std;
class foo
{
public:
static int array[2];
};
int foo::array[2] = {0}; //I should be able to omit this line
int main()
{
cout << "foo::array[0] = " << foo::array[0] << endl;
return 0;
}
PS: No C++11