I seem to be getting a really weird error. Basically, I have a class A that is meant to manage a disk cache for pixel data. From the main program, I create an object of A using:
A* obj = new A(...);
Then, I call a method to read a pixel from the disk:
Pixel pix = obj->read(...);
However, when I try to use the "this" pointer to access private member variables of A from within the read() method, I get an access violation error because the "this" pointer is uninitialized (set to 0xCCCCCCCC by MSVC 2012). However, I checked the value of the "obj" pointer returned by the constructor, and it seems to be a valid address.
My guess is that somehow the constructor failed, but why, then, would it have returned a pointer to the object? Alternatively, if the constructor didn't fail, why is the "this" pointer uninitialized from within the class?