Crossware

Table of Contents        Previous topic       Next topic       

C/C++ COMPILER->Function Calling Conventions->CDecl Calling Convention

In the absence of the /Gr or /Gz options, __cdecl is the default calling convention.

Functions declared with the __cdecl qualifier will also use the __cdecl calling convention, overriding any /Gr or /Gz option.  The standard C library functions are declared with the __cdecl keyword.

All arguments, unless declared with the register keyword, are pushed onto the stack starting from the rightmost argument and finishing with the leftmost argument.  For functions declared with an ellipsis (...), the register keyword is ignored.

The arguments are popped from the stack after the called function returns.  (Caller pops stack.)

Arguments declared with the register keyword will be passed in registers if an appropriate register is available.  Arguments are passed in registers R0, R1, R2 and R3. Candidate arguments for passing in registers are selected from left to right.