I've been reading up on the differences in 32bit calling conventions. The fastcall
vs. stdcall
ordeal that is.
From what I read there was great confusion with the two conventions, and 64 bit was standardized to avoid this confusion.
I have to ask, why was fastcall
chosen?
Also, since fastcall
and stdcall
are win32 terms, what is the UNIX term for function calling that does or does not use registers for passing arguments?
x86 Calling Conventions - Wikipedia, the free encyclopedia provides a list.
The common calling convention on x86-32 is
cdecl
. GCC provides a function attribute__attribute__((regparm(n)))
to indicate thatn
arguments are passed by register, but this is not the same asfastcall
. Either way, arguments are passed in callee-clobberable registers, so there is no additional cost (and saves the effort of adding stack space for arguments then cleaning it up) for function calls relative tocdecl
(forregparm
) andstdcall
(forfastcall
).To aid in your confusion, the x86-64 calling conventions on Windows and Linux are different both from those on x86-32 and from each other. Neither is
fastcall
, although both use a significant number of registers to pass arguments.