When I try to compile the following with g++:
const int zero;
int main()
{
return 0;
}
I get an error about an uninitialized const 'zero'
. I thought that global variables were default initialized to 0 [1] ? Why isn't this the case here?
VS compiles this fine.
[1] For example, see https://stackoverflow.com/a/10927293/331785