I have a class:
class A
{
public:
void foo(void)
{
// equals to syntactically incorrect (&this == nullptr)
if (*(void**)this == nullptr)
return;
...
}
};
I use it like this:
A * a = new A;
...
delete a;
...
a->foo();
Why the condition is true
for release version only? If I switch to debug version, I usually get something like 0xFEEFEEFE.
EDIT
Ok guys. What you said is absolutely right, and I knew that. Undefined behavior is something that is not specified by standard. This is what every platform implements (but implements) in its own way.
The purpose of this question is to understand how is it implemented in Windows. This code always works properly ('always properly' means: on all versions of Windows (starting with xp) with any compiler the method is called and the statement is true)). In my case I want to know what usually happens if the object is deleted in Windows.
P.S. I should have asked this question in wasm.ru. Sorry.