Recently, I read a coding example that explained the following would cause a compiler error in Visual Studio:
int* pointer1;
*pointer1 = 10;
The author claimed that since pointer1 is uninitialized before being dereferenced, the following error occurs in Visual Studio:
C4700: uninitialized local variable "pointer1" used
And it does. This scenario makes sense.
However, if I use the exact same code and compile with g++, no compiler error occurs and I'm free to use pointer1 in any normal fashion.
Why the difference? Is g++ assigning an address to pointer1 before initialization?