鱼有胖的头

导航

Code Reading -chap5

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

+  

+                    Chapter5: Advanced Control Flow

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

98.  Recursively defined algorithms and data structures are often implemented by using

      recursive functions.(P.144)

      递归定义算法以及数据结构通常由使用递归函数来实现。

---------------------------------------------------

99. To reason about a recursive function,start from the base case test and construct an informal argument

      on how every recursive invocaion will lead its execution closer to the nonrecursive base case code.(p.147)

      如何去推断一个递归函数呢?可以以基础情形测试,以及构建一个关于“每一次递归调用怎样的将其执行进一步靠

     近基于非递归情形的代码”这样的非正式的参数作为开始。

---------------------------------------------------

100.  Simple languages are often parsed using a series of  functions that follow the language’s

        grammer structure.(p.147)

        简单语言常常用一系列的跟随该语言的语法构造之函数来解析。

---------------------------------------------------

101. Reason about mutually recursive functions by considering the recursive definition of the

      underlying concept.(p.147)

      通过递归定义基础概念来推断互递归函数。

---------------------------------------------------

102.  Tail—recursive calls are equivalent to a loop going back to the beginning of the  function.(P.147)

         尾递归调用等价于一个返回函数开始的循环。

---------------------------------------------------

103. You can easily locate the methods that might throw an implicitly generated exception by

       running the Java compiler on the class source after removing the throws clause from the

       method definition.(P.151)

      你可以很容易的“通过运行JAVA编译器于源类之前就从方法定义中移除抛出从句” 定位到一个有可能抛出

      一内生的例外的这么一个方法。

---------------------------------------------------

104.Code using multiprocessor machines is often structured around processes or threads.(P.156)

       使用多处理器的代码常常被结构化为围绕处理器或者线程而设计的。

---------------------------------------------------

105.The work crew parallelism model is employed to distribute work among processors or to create

        a pool of tasks to be used for allocating standardized chunks of incoming work.(P.157)

          所谓“并行工作组模型” 用于将工作在处理器之间进行分布,或者用于生成一个任务池用于分配标准的

          相关于输入工作的块。

---------------------------------------------------    

106. The thread—based boss/worker model of parallelism is typically used to maintain responsiveness

       of a central task by delegating expensive or blocking operations to worker subtasks.(P.158)

       基于线程的 老板/员工之并行模型 (译注:区别于生产者消费者模型),典型的通过”昂贵的授权或者对

       员工子任务的阻塞操作“用于维护对一中央任务的反应。

---------------------------------------------------    

107.  The process-based boss/worker model of parallelism is typically used for reusing existing programs

       or to structure and isolate coarse-grained system modules with well—defined interfaces.(P.159)

        基于进程的老板/员工之并行模型典型的用来重用已存在代码或者构建或隔离有良定义接口的粗粒度系统模块。

---------------------------------------------------    

108.  In pipeline—based parallelism,each task receives some input,performs processing on it,and

         passes the resulting output to the next task for more processing.(P.161)

         基于流水线的并行中(译注:应指流水线线程模型),各个任务都会收到一些输入,并对输入执行一点处理,

         并将结构的处理输出放置到  下一个任务以进行更多的处理。

       (译注:任务与任务之间组成了一个前后相接的管道,也是 *nix系统的一个显著特点)

---------------------------------------------------

109.  Race conditions are subtle and often have the code leading to them spread over multiple functions

        or modules.The resultant problems are therefore difficult to isolate.(P.166)

        竞争条件是微妙的,并常常使代码将其扩散到多个函数或者多个模块之上。从而引发的问题不容易被隔离。

---------------------------------------------------

110. View with extreme suspicion data structure manipulation code and library calls that appear within

       a signal handler.(P.168)

      要有高度的警觉来看待这样的数据结构:其操控代码以及库调用仅仅出现在单独的句柄内部。

---------------------------------------------------

111.  When reading code that contains macros, keep in mind that macros are neither  functions

         nor statements. (p.172)

         当你读到的代码包含宏的时候,要记住宏既不是函数也不是声明。

---------------------------------------------------

112.  Macros defined inside a do ... while (0) block are equivalent to the statements  inside the block. (p. 174)

        宏定义在do ... while (0) 结构中时,等价于在该结构中的声明。

---------------------------------------------------

113.  Macros can access local variables visible at the point they are used. (p. 175)

        宏可以,在本地变量被使用的那些点上进行可视化的获取(?)

---------------------------------------------------

114.  Macro calls can change the values of their arguments. (p. 175)

        宏调用可以改变它们参数的值。

---------------------------------------------------

115.  Macro-based token concatenation can create new identifiers. (p. 176)

        基于宏的记号连接可以生成新的标识符。

+++++++++++++++++++++++end of chap 5+++++++++++++++++++++++++++++++++++

posted on 2011-06-24 23:56  鱼有胖的头  阅读(172)  评论(0编辑  收藏  举报