M
/*
* How can a stack underflow happen in C++?
*
* The only way I can see this actually happening would be if you
* declared a function to use the stdcall (or any other calling
* convention that specifies the callee clean the stack) and then invoke
* the function through a function pointer that was specified as a cdecl
* (or any other calling convention where the stack is cleaned by the
* caller). If you do that, the called function will pop the stack
* before returning and then the caller would also pop the stack leading
* to underflow and terrible things.
*
* In the specific case of member functions, the calling convention is
* usually referred to as thiscall and whether the caller or the callee
* cleans the stack depends on the compiler.
*
* See here (http://en.wikipedia.org/wiki/X86_calling_conventions) for
* details of calling conventions.
*
* [Sean] [so/q/6552141] [cc by-sa 3.0]
*/