Pass by value-from bruce eckel

Joined
Mar 4, 2011
Messages
2
Reaction score
0
Hi all of you,
i was reading "thinking in c++" and found difficulties while comprehend the following
Code:
int f(int x, char c);
int g=f(a,b)
//then gave the corresponding generic assembly code
push b
push a
call f()
add sp,4
mov g,register a
i was not able to understand the following lines
1.The calling code is responsible for cleaning the argument off the stack
doubt:how does calling code clean the passed argument
2.compiler knows everything there is to know about return value type because that type is built into the language,so the compiler can return it by placing it in register
doubt:how does the compiler knowledge about the return type is related with placing return value in register
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top