鱼有胖的头

导航

Code Reading -chap3

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

+  

+                    Chapter3: Advanced C Data Types

+

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

52. By recognizing the function served by a particular language construct, you can better understand

     the code that uses it. (P61)

     通过识别出某个由特定语言构建所服务的功能,你可以更好的理解使用于该功能的代码。

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

53. Recognize and classify classify classify the reason behind each use of a pointer.(P61)

     对一指针的每次使用背后之原因需要进行识别以及归类。

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

54. Pointers are used in C programs to construct linked data structures, to dynamically allocate  data structures,

     to implement call by reference, to access and iterate through data element, when passing arrays as

    arguments, for referring to functions, as an alias for another value, to represent character strings, and for

    direct access to system memory. (P62)

     C语言中的指针用于构建链接化的数据结构, 用于动态的分配数据结构时, 用于以引用方式实现调用时, 用于存取

     以及在数据元素之上的遍历时,用于当将数组作为参数传递时,用于为提交到一个函数时,用于作为拥有另一个值的

     别名存在时候,用于表示一个字符数组时, 用于直接存取系统内存时。

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

55. Function arguments passed by reference are used for returning function results or for avoiding the

     overhead of copying the argument.(P63)

     通过引用来传递函数参数,这通常用于返回函数的结果时,或者出于为了避免过度的拷贝那个被传递的参数的目的时。

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

56. A pointer to an array element address can be used to access the element at the specific position index. (P65)

     一个指向数组元素地址的指针可以用于获取在特定位置索引处的那个数组元素。

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

57. Arithmetic on array element pointers has the same semantics as arithmetic on the respective array indices.

   元素为指针的数组之算法与元素为数组索引的算法有相同的语义。

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

58. Functions using global or static local variables are in most cases not reentrant.(P66)

      那些使用全局好哦者静态本地变量的函数在大多数情况下是不可重入的。

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

59. Character pointers differ from character arrays.(P72)

     字符指针与字符数组是不同的。

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

60. Recognize and classify the reason behind each use of a structure or union.(P75)

     识别出各个结构体或者联合,并将其背后所隐藏的原因进行归类。

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

61. Structures are used in C programs to group together data elements typically used as a whole, to return

      multiple data elements from a function, to construct linked data structures, to map the organization of data

      on hardware devices, network links, and storage media, to implement abstract data types, and to program in

      an object-oriented fashion.(P75)

      用于C语言的结构体典型的将多个数据元素作为一个整体使用,该结构体用于从函数中返回多个数据元素,用于构建链接化的

      数据结构,用于将数据的组织映射到硬件设备,网络链接以及存储媒介上去,用于实现抽象数据类型,

      以及用于以面向对象风格进行的编程。

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

62. Unions are used in C programs to optimize the use of storage, to implement polymorphism,

     and for accessing different internal representations of data.(P80) 

      C语言中使用的联合体,用于优化对存储的使用,用于实现多态,以及用于获取数据的不同内部表示。

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

63. A pointer initialized to pointe to storage for N  elements can be dereferenced as if it were an array

     of N ELEMENTS.(p85)

     一个指针被初始化为指向N个元素的存储时,就可以将它解除索引,好似一个有N个元素的数组一般对待。

   (译注:这段说明针对的是原书动态内存分配相关代码而言。)

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

64. Dynamically allocated memory blocks are freed explicitely or when the program terminateds or through

     use of a garbage collector; memory blocks allocated on the stack are freed when the function they were

     allocated in exits.(P87)

     动态分配内存块要进行明确的释放——或者就是当程序终止,再或者就是通过使用垃圾收集器;

     当“在栈上的内存块分配”被分配到的函数退出的时候,它(译注:指 在栈上的内存块分配)需要被释放掉。

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

65. C programs use typedef declarations to promote abstraction and enhance the code's reacability,

     to guard against protability problems, and to emulate the class decraraion behavior of C++ and JAVA.(p91)

     C语言使用了typedef 关键字声明用来提升抽象以及代码的可读性,这是为了与可移植性问题战斗, 以及

    为了模仿C++与JAVA中的类的行为。

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

66. You can read typedef declaration as if they were varaible definitions: the name of the varaible beinig

     defined is the type's name; the varaible's type is the type corresponding to that name.(P91)

     你可以把typedef 声明读作好像就是变量定义一般:被定义的变量的名字就是类型名;变量的类型是与那个名字相对应的类型。

+++++++++++++++++++++++++ end of chap3 ++++++++++++++++++++++++++++++++

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