跳过正文

系编-Function Call

·82 字· loading · loading ·
Masterlong
作者
Masterlong
熬夜,但是世界之夜
系统级编程 - 这篇文章属于一个选集。
§ 3: 本文

函数调用&返回
#

(重点)


  • 为什么使用函数
    • 代码重用 by 不同输入->返回值

caller & callee

在汇编中 称之为procedure


conclusion

  • parameters
  • local vars
  • return value
  • return address

作用域(scope)matters

  • 变量命名

形参(former parameter)&实参(actual parameter)


img

Because the compiler does not know how many variables it will need to allocate dynamically, it reserves a lot of space for expansion.


img

The stack frame usually includes the following items

  • arguments (parameter values) passed to the routine;

  • return address back to the routine’s caller;

  • caller’s ebp;

  • space for the local variables of the routine- saved registers

系统级编程 - 这篇文章属于一个选集。
§ 3: 本文

相关文章

系编-Representation of code
·164 字· loading · loading
系编-intro
·53 字· loading · loading
图形学-3
·37 字· loading · loading