This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
gcc memory reservation
- From: "aton" <aton1337 at hotmail dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Tue, 21 Jan 2003 18:21:13 +0100
- Subject: gcc memory reservation
i have a little problem ...
my testprogram:
------------------ start buffers.c -----------------------
void function(int a, int b, int c) {
char buffer1[5];
char buffer2[10];
}
void main() {
function(1,2,3);
}
------------------ end buffers.c -----------------------
compiled with: gcc -S -o buffers.s buffers.c
in buffers.s i have the function() with:
function:
pushl %ebp
movl %esp,%ebp
subl $40,%esp
leave
ret
now my question... how does gcc work out a number of 40 ??? i read some
about memory reservation and it said, it should reserve only 20 bytes:
buffer1 uses 8 bytes and buffer2 uses 12 bytes (always 4-byte words are
reserved).
so how can i know it will be 40 bytes that are reserved?
thanks in advance, aton