functions in assembler

Posted by stupid_idiot on Stack Overflow See other posts from Stack Overflow or by stupid_idiot
Published on 2010-03-10T18:42:24Z Indexed on 2010/03/14 13:45 UTC
Read the original article Hit count: 191

Filed under:
|
|

hi,

i have philosophised about the purpose of stack a little bit and after some coding i figured out what is it's strength. The only thing that lies in my stomache is how does it work with functions? I tried to make some easy function for adding two numbers using universal registers but I suppose that's not how does it work in C for example.. where are all the parameters, local variables and where is the result stored?

how would you rewrite this to assembler?(how would compiler for C rewrite it?)

int function(int a, int &b, int *c){
 return a*(b++)+(*c);
}

i know this example kinda sucks.. but this way i can understand all the possibilities

© Stack Overflow or respective owner

Related posts about assembly

Related posts about functions