Re: calling convention stdcalll and cdecl call
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Fri, 18 Jul 2008 09:12:43 -0400
"Alf P. Steinbach" <alfps@xxxxxxxx> wrote in message
news:XMudnXxazN5UzR3VnZ2dnUVZ_oWdnZ2d@xxxxxxxxxxxxx
* Igor Tandetnik:
With stdcall, the function is responsible for removing its parameters
from the stack. To do this, it must know how many parameters there
are, and thus cannot take variable number of parameters.
I'm sorry, that's incorrect (counter-example below).
Your example uses additional domain-specific information that the
compiler doesn't have, in general: that the first parameter specifies
the total number of remaining parameters, and that all parameters are
the same size.
Or are you suggesting that the caller should pass the total size of all
parameters as a hidden first parameter? That defeats the whole point of
__stdcall convention, which is to shave one machine instruction off the
call site. If you are willing to push the size of parameters onto the
stack before the call, you can just as well update ESP after the call
instead - at which point you are happily back in __cdecl land.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- Re: calling convention stdcalll and cdecl call
- From: Alf P. Steinbach
- Re: calling convention stdcalll and cdecl call
- References:
- Re: calling convention stdcalll and cdecl call
- From: Igor Tandetnik
- Re: calling convention stdcalll and cdecl call
- From: Alf P. Steinbach
- Re: calling convention stdcalll and cdecl call
- Prev by Date: Re: process termination
- Next by Date: Re: calling convention stdcalll and cdecl call
- Previous by thread: Re: calling convention stdcalll and cdecl call
- Next by thread: Re: calling convention stdcalll and cdecl call
- Index(es):
Relevant Pages
|