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]

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/


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