Boolean类型把0作为False,1作为True;ByteBool、WordBool和LongBool把0作为False,非0作为True。
Enumerated types(枚举类型)
若枚举类型的值不超过256个,并且在 {$Z1} 状态(默认)下声明,它被存储为一个无符号字节;若枚举类型的值超过256个,或在 {$Z2} 状态下声明,它被存储为一个无符号字;若枚举类型在 {$Z4} 状态下声明,它被存储为无符号双字。
Real types(实数类型)
The real types store the binary representation of a sign (+ or ?), an exponent, and a significand. A real value has the form
+/?significand * 2^exponent
- 154 -
Memory management
where the significand has a single bit to the left of the binary decimal point. (That is, 0 <= significand < 2.)
In the figures that follow, the most significant bit is always on the left and the least significant bit on the right. The numbers at the top indicate the width (in bits) of each field, with the leftmost items stored at the highest addresses. For example, for a Real48 value, e is stored in the first byte, f in the following five bytes, and s in the most significant bit of the last byte.
Pointer types(指针类型)
指针类型有4个字节,作为一个32位地址。指针值nil存储为0。
Short string types(短字符串类型)
短字符串占用的字节数是它的最大长度加1,第一个字节存储字符串的当前(动态)长度,剩下的字节存储字符串的字符。
存储(字符串)长度的字节和字符都被看作无符号值。最大字符串长度是长度的字节(string[255])。
Long string types(长字符串)
长字符串变量是一个占用4字节内存的指针,指向一个动态分配的字符串。符串长度为零),指针为nil并且不分配动态内存。对一个非空值,字符串指针指向一个动态分配的内存块,这个内存块包含了字符串的实际内容,并且还有一个32位的值来指示字符串的长度,个32位的引用计数。下面的表格说明了内存块的分配情况。偏移量 内容
-8 32位引用计数
-4 长度(字节数) 0..Length-1 字符串
Length
NULL字符(#0)
内存块末尾的NULL字符由编译器和内置的字符串处理例程自动维护,这使得长字符串能直接转换为一个零结尾字符串。
对字符串常量和文字串(literal),编译器象动态分配时一样为其分配内存,但把它的引用计数设置为-1。当把字符串常量赋给一个字符串变量时,字符串指针指向为常量分配的内存块。当字符串引用记数为-1时,内置的字符串处理例程知道不能去修改它。
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-23665-115.html
可能是思维错了