Answer the question
In order to leave comments, you need to log in
Kernel convention in C++ subroutines
What is the difference between the conventions of the C++ language and, for example, Pascal about working with the kernel in subroutines? This means that clearing the stack when exiting subroutines on assembler'e in C ++ is carried out automatically, but not in other languages.
Answer the question
In order to leave comments, you need to log in
In C and C++, by default, the stack is cleared by the calling code after a call. This was done so that functions with a variable number of parameters would work (after all, only the calling code knows how many parameters it put on the stack). In Pascal, it is accepted that the called function itself cleans the stack.
Different operating systems may have different API calling conventions, Windows adopts the Pascal variant, so all Windows kernel functions are declared with the __stdcall modifier. Accordingly, the __cdecl modifier defines functions that use the sish parameter passing convention.
Do you mean calling conventions , i.e. , stdcall
etc. fastcall
? Actually this is the difference, some clean, others do not. If you do not write your own libffi
, then it remains only to monitor the correctness of the declarations.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question