In a word: None.
Consider this code:
__cdecl int foo(int a, int b)
{
a = 5;
b = 6;
return a + b;
}
int main()
{
return foo(1, 2);
}
This created this asm output (compiled with -O0):
movl $5, 8(%ebp)
movl $6, 12(%ebp)
movl 8(%ebp), %edx
movl 12(%ebp), %eax
addl %edx, %eax
popl %ebp
ret
Thus, it is quite possible that the __cdecl function stomps on the stack values.
This is not even considered the possibility of embedding or other optimization magic, where, in the first place, not everything can be on the stack.
source
share