Pass by value-from bruce eckel

Discussion in 'C Programming' started by fluteofcoder, Mar 4, 2011.

  1. fluteofcoder

    fluteofcoder

    Joined:
    Mar 4, 2011
    Messages:
    2
    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
    fluteofcoder, Mar 4, 2011
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marcello
    Replies:
    0
    Views:
    352
    Marcello
    Apr 28, 2006
  2. Marcello
    Replies:
    0
    Views:
    344
    Marcello
    Apr 28, 2006
  3. Marcello
    Replies:
    2
    Views:
    378
    Alex Hunsley
    Apr 29, 2006
  4. Arindam Gupta

    "C++ Inside & Out" by Bruce Eckel

    Arindam Gupta, Jun 27, 2003, in forum: C++
    Replies:
    1
    Views:
    2,713
    chris lowth
    Jun 27, 2003
  5. Will Stuyvesant
    Replies:
    2
    Views:
    300
    PiedmontBiz
    Jan 9, 2004
Loading...

Share This Page