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

后端 未结 8 618
感情败类
感情败类 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 12:02

    Are they "const" functions?

    A const function is one which is declared with the keyword const, and this indicates that it will not change any of the members, only read them (like accessor functions)

    An optimising compiler may not bother passing the 'this' pointer to some const functions if it doesn't even read from non-static member variables

    An optimising compiler may search for functions which could be const, make them constant, and then not pass a this pointer into them, causing the debugger to be unable to find the hook.

提交回复
热议问题