This question is a follow up of this one where the consensus was that the value of *this* pointer is not correct because of optimization
but what does not correct
means?
- That we can't trust the value of this pointer so we should throw it out all together when we debug a release build?
- That this pointer may change its value as we debug a release build and that's okay because its optimized code, it may not mean any harm?
- this pointer still points to a valid memory block of the object and the fact it changes is cause of concern even when its optimized code.
- There is mismatch between the actual code and the optimized generated code, this is why the debugger may show incorrect values or values of variables may change abruptly? I could understand if debugger shows incorrect values but why should these values change?
How do we debug optimized code? A lof of times for exmaple with WinDbg we peek into pointers, objects layouts, stack pointers even instruction pointers..does it mean we can't rely on these values because it's an optimized code? What can we rely on and what not?