This simple code (MCVE):
#include <stdio.h>
int a = 3;
int main(){
printf("%d\n", a);
return 0;
}
int a; // This line
To my surprise, GCC (MinGW GCC 4.8.2, 4.9.2 and 6.3.0) does not give any error, not even warnings about the marked line! However it does if I assign a value to a at its second definition.
More strangely, g++ tells me that the second re-definition is an error, but gcc doesn't.
Isn't it supposed to be a re-definition of an existing variable because there's no keyword extern?