A theoretical question: Sorry if its a beginner question.
Here is a quote from the MSDN explaning the C/C++ calling convention.. It
demonstrates that the calling function is responsible to clean the stack
pointer and it does it by the command "add esp,8" after returning from
the called function.
My questions:
1. Is the stack pointer common in a certain thread(or process)?
2. How does the called function get the parameters, is it by performing
twice pop functions?
3. If it pops twice why is there any need to clean the stack?
int _cdecl CFunc(int a, int b);
calling function called function
-------------------------------------------
push b _CFunc PROC NEAR
push a .
call _CFunc .
add esp,8 .
. RET
. _CFunc ENDP