Re: Stack space and declarations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

which architecture are you talking about? On PowerPC, if none of the variables are marked volatile, then probably no stack space will be allocated for the variables. This depends on the ABI of the processor, I'd believe.

Cheers,
Andreas

Václav Haisman wrote:
Hi,
first some C code:

void foo (int x)
{
  int y = 0;
  if (x) {
    int z = 0;
    // some more code
  }
  else {
    int w = 0;
    // some more code
  }
}

Now, how much stack space is getting allocated in the function? Is it
(assuming 32bit architecture) 2*4=8 bytes (y + (z or w)) or is it 3*4=12
(each variable gets its own slot)?


Vaclav Haisman


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux