This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Stack space and declarations


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

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]