With C++, I get pointer with 0xcdcdcdcd when creating a class - what is happening?

Steven picture Steven · Nov 26, 2011 · Viewed 25.1k times · Source

----------------EDIT-----------------------

I was grabbing the wrong value for comparison, the cdcdcdcd was coming from somewhere else. I still have my methods throwing exceptions before they are even reached, but my problem lies elsewhere, I wish there was a way to just "unpost" my original question. Thanks for the help.

----------------EDIT-----------------------

I have a class (MyClass) I have inherited from some third party class (which in turn derives from direct show classes - from CBaseFilter if this matters). I write this code:

MyClass* val = NULL;
val = new MyClass(); // Create an instance of the class.

Attempting to make method calls results in a thrown exception. With a little sleuthing I found that when I dereference val (val itself seems valid... something like 0x0777fc90), it contains 0xcdcdcdcd. I looked around and it seems that this might indicate that the memory has been allocated on the heap, but not initialized.

What does that mean?! How can the call to new succeed (val != NULL) and yet the memory isn't initialized enough to have a pointer to it? Is it possible that something went wrong with some of the base class initialization? And if so - what am I looking for?