B
bahadir.balban
Hi,
When you define varibles in the middle of your function call (C99),
such as:
if(i == 5) {
int x = 5;
int z = 2;
}
Are they allocated on the stack as they're encountered at run-time or
are they allocated before, along with the arguments and initial
variable declarations? Is a function activation record supposed to be
fixed before you start executing the function code (i.e. statements)?
If this is done at run-time, how does the (standard) compiler do it?
I have also heard about an alloca() call for allocating on the stack.
Is this a non-standard function? Is there a possibility of stack
overflow by doing this?
Thanks,
Bahadir
When you define varibles in the middle of your function call (C99),
such as:
if(i == 5) {
int x = 5;
int z = 2;
}
Are they allocated on the stack as they're encountered at run-time or
are they allocated before, along with the arguments and initial
variable declarations? Is a function activation record supposed to be
fixed before you start executing the function code (i.e. statements)?
If this is done at run-time, how does the (standard) compiler do it?
I have also heard about an alloca() call for allocating on the stack.
Is this a non-standard function? Is there a possibility of stack
overflow by doing this?
Thanks,
Bahadir