Historically, the Fortran and Pascal languages used a convention where the caller pushed its arguments on the stack (first parameter first in stack), and then called the callee function. The prologue code in the callee usually popped the return address and the parameters, and pushed again the return address ( this part is in fact an implementation detail). When the callee returns, the stack is clean.
The C language then came with the ability to call a function with a variable number of arguments. The convention was that the caller pushed the parameters in inverse order (last parameter first in stack) and then called the callee function. The callee then accessed the parameters in the stack without popping anything (the address of the first parameter is just near the return address). When the callee returns, the stack still contained the parameters and the caller should clean them.
This is still used in the Windows system, where most of the API function use the pascal convention (winapi
) while by default C or C++ methods use by default the C (cdecl
) convention.