For example declaring a reference without assigning it to something gives a compiler error eg. int &refVar;
but this doesn't holds true for pointers. I get that c++ skips some sane default features like skipping bound checks etc to gain speed but this theory dosen't fits well with pointer variables.
Why would someone declare a pointer variable and not initialize it to something? And why not to NULL
/0
or even nullptr
? Most static analyzers actually point out this problem, but what could be the possible reason to define this undefined behaviour? Isn't this a great source of bugs?