Visual Studio not able to show the value of 'this' in release mode (with debug information)

后端 未结 8 566
感情败类
感情败类 2020-12-29 11:15

Original question:

Why is the this pointer 0 in a VS c++ release build?

When breaking in a Visual Studio 2008 SP1 release build with the /Zi

8条回答
  •  伪装坚强ぢ
    2020-12-29 11:45

    Because you wrote a bugged program and called a member function on a NULL pointer.

    Edit: Reread your question. Most likely, it's because the optimizer did a number on your code and the debugger can't read it anymore. If you have a problem specific to Release build, then it's a hint that your code has a dodgy #ifdef in it, or you invoked UB that just happens to work in Debug mode. Else, debug with Debug build. However, that's not terribly helpful if you actually have a problem in Release mode you can't find.

提交回复
热议问题