Re: Is there stack associated when a executing an inline function?
- From: richard@xxxxxxxxxxxxxxx (Richard Tobin)
- Date: 29 Feb 2008 22:16:37 GMT
In article <47C869B8.AD1D36AD@xxxxxxxx>,
Morris Dovey <mrdovey@xxxxxxxx> wrote:
However, it wouldn't be weird at all if the inlined procedure simply
moves the stack pointer by some delta to enlarge the current frame,
then references all of its locals with respect to the current frame,
and then moves the stack pointer back by the same delta upon
termination to release the storage.
But what would be the point?
It'd allow re-use of that memory by another (subsequent) inlined
procedure or function call. Waste not, want not.
Multiple inlined functions can use the same stack space without
adjusting the stack pointer. It's not significantly different from:
void foo(int a)
{
...
{
int b;
...
}
...
{
double c;
...
}
...
}
But actually I'd misread the article; it is indeed quite reasonable to
adjust the stack pointer during the execution of a function, and it
can be done even when there are no inline function calls or nested
blocks, at the end of some variable's useful life. I don't know if
any C implementations do that, but some implementations of other
languages do.
-- Richard
--
:wq
.
- References:
- Is there stack associated when a executing an inline function?
- From: Mahesh
- Re: Is there stack associated when a executing an inline function?
- From: Kaz Kylheku
- Re: Is there stack associated when a executing an inline function?
- From: Richard Tobin
- Re: Is there stack associated when a executing an inline function?
- From: Morris Dovey
- Is there stack associated when a executing an inline function?
- Prev by Date: Re: dual core and c
- Next by Date: Re: printf() causes core dump
- Previous by thread: Re: Is there stack associated when a executing an inline function?
- Next by thread: Re: Is there stack associated when a executing an inline function?
- Index(es):
Relevant Pages
|