I'm trying to walk the stack of this sample program:
#include <windows.h>
void Func1()
{
Sleep(1000);
}
void开发者_JS百科 Func2()
{
Sleep(1000);
Func1();
}
void Func3()
{
Sleep(1000);
Func2();
}
void main()
{
for (int i = 0; i < 100; i++)
{
Func3();
}
}
In debug mode I get what you'd expect. Something like:
Sleep Func3 mainIn release mode (with frame pointer optimization enabled) I get the stack:
Sleep mainWhere did the function between "main" and "sleep" go in the release run?
The function was inlined.
I simply change the "Inline Function Expansion" to Only_inline (in VS2008) and the missing function appears. :)
精彩评论