|
Boost : |
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2005-07-07 16:01:26
> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Tobias Schwinger
> >>Apologies for the OT, but why "verbose"? __stdcall isn't verbose at
> >>all.
> >
> >
> > Sorry, underhanded (yet well-deserved) shot at Pascal.
> ^ ;-) ^
>
> Btw. "__pascal" and "__stdcall" are not exactly the same:
> Both require the callee to clean up but the arguments are
> ordered differently on the stack.
Hmm, didn't know there was a difference. In any case, the callee cleanup is the
part that makes it inferior to __cdecl. It isn't as general, both for variadics
and possible tail-recursion optimizations--particularly in mutually
tail-recursive functions:
int g(int x);
int f(int x) {
return g(x);
}
int g(int x) {
return f(x);
}
(Yes, I know there is no termination.) The point is that the compiler could
push 'x' onto the stack from external code, but 'f' and 'g' could call each
other repeatedly without touching the stack at all, and then when the call
actually does return to the external code, the external code can pop 'x' from
the stack. This can work even if 'f' and 'g' are separately compiled (i.e. not
optimized as a unit). This doesn't work under 'callee cleanup' without extra
scaffolding because the callee cannot know if 'x' should be popped.
Regards,
Paul Mensonides
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk