This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
call stack's order of parameters
- From: Andre Kirchner <supercroc1974 at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 27 Aug 2007 15:22:40 -0700 (PDT)
- Subject: call stack's order of parameters
Hi all,
What are the rules of a call stack regarding the order
in which parameters are placed? Program 1 creates the
call stack (pointer to "HELLO", pointer to
"ANDRE_KIRCHNER", 0xFF), while Program 1 creates the
call stack (pointer to "ANDRE_KIRCHNER", pointer to
"HELLO", 0xFF).
Thanks in advance,
Andre
##############################################################
PROGRAM 1:
##############################################################
#include <stdio.h>
void function(char * sentenceA, char * sentenceB, int
number)
{
}
int main()
{
function("ANDRE_KIRCHNER", "HELLO", 0xFF);
return 0;
}
##############################################################
ASSEMBLER CODE 1:
##############################################################
.file "main.c"
.text
.globl function
.type function, @function
function:
pushl %ebp
movl %esp, %ebp
popl %ebp
ret
.size function, .-function
.section .rodata
.LC0:
.string "HELLO"
.LC1:
.string "ANDRE_KIRCHNER"
.text
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell.
http://searchmarketing.yahoo.com/