美文网首页
Instructions: Language of the

Instructions: Language of the

作者: 刘东利2020 | 来源:发表于2023-01-23 19:31 被阅读0次

    2.8 Supporting Procedures in Computer Hardware

    这一节讲的是各种过程(procedures):

    procedure A stored subroutine that performs a specific task based on the parameters with which it is provided.

    这里的定义有点“套套逻辑” —— subroutine被翻译为“子程序”,但是如果查一查subroutine:

    所以作者随后又打了个比方:

    You can think of a procedure like a spy who leaves with a secret plan, acquires resources, performs the task, covers his or her tracks, and then returns to the point of origin with the desired result. Nothing else should be perturbed once the mission is complete. Moreover, a spy operates on only a “need to know” basis, so the spy can’t make assumptions about the spymaster.

    对于这个比方,具象化来说就是六个步骤:

    1. Put parameters in a place where the procedure can access them.

    2. Transfer control to the procedure.

    3. Acquire the storage resources needed for the procedure.

    4. Perform the desired task.

    5. Put the result value in a place where the calling program can access it.

    6. Return control to the point of origin, since a procedure can be called from several points in a program.

    相关文章

      网友评论

          本文标题:Instructions: Language of the

          本文链接:https://www.haomeiwen.com/subject/mnalhdtx.html