摘要: 变体结构也就是变体记录, 是一个比较复杂的概念. 专家不提倡使用. 兴趣所致, 我想把它弄明白. 一个最大的无符号整数(Cardinal)是 4294967295, 它的大小是 4 字节, 它的二进制表示是: 11111111 11111111 11111111 11111111 它的低字节的值是 11111111, 也就是十进制的 255 //测试: var c: Cardinal... 阅读全文
posted @ 2008-01-09 18:03 万一 阅读(6174) 评论(7) 推荐(0)
摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-01-09 18:01 万一 阅读(4803) 评论(11) 推荐(0)
摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button... 阅读全文
posted @ 2008-01-09 16:59 万一 阅读(3458) 评论(3) 推荐(0)
摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button... 阅读全文
posted @ 2008-01-09 16:03 万一 阅读(3713) 评论(5) 推荐(0)
摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button... 阅读全文
posted @ 2008-01-09 14:50 万一 阅读(3438) 评论(1) 推荐(0)
摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-01-09 13:39 万一 阅读(6973) 评论(13) 推荐(0)
摘要: type TRec1 = record name: string[12]; age: Word; end; TRec2 = record name: string[12]; age: Word; end; var RecA,RecB: TRec1; RecX,RecY: TRec2; procedure TForm1.Button1C... 阅读全文
posted @ 2008-01-09 13:33 万一 阅读(4064) 评论(5) 推荐(0)
摘要: type TRec1 = record i: Integer; w: Word; end; TRec2 = packed record {压缩结构: 牺牲效率, 减小尺寸} i: Integer; w: Word; end; procedure TForm1.Button1Click(Sender: TObject); begin Show... 阅读全文
posted @ 2008-01-09 13:15 万一 阅读(4228) 评论(3) 推荐(0)
摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-01-09 13:05 万一 阅读(5797) 评论(17) 推荐(0)
摘要: //动态数组一般是不需要手动释放的, 如果需要... var arr: array of Integer; begin {设置动态数组维数} SetLength(arr,10); {释放方法一} arr := nil; {释放方法二} SetLength(arr, 0); {释放方法三} Finalize(arr); end; 阅读全文
posted @ 2008-01-09 00:51 万一 阅读(10770) 评论(14) 推荐(1)
摘要: type TABC = 'A'..'G'; {定义子界} var abcArr: array[TABC] of Integer; {定义数组} abc: TABC; {定义子界变量} begin {数组赋值} abcArr['A'] := 11; abcArr['B'] := 22; abcArr... 阅读全文
posted @ 2008-01-09 00:32 万一 阅读(3035) 评论(0) 推荐(0)
摘要: type TMyEnum = (Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday); {定义枚举} var weekArr: array[TMyEnum] of string; {定义数组} myEnum: TMyEnum; {定义枚举变量} begin {数组赋值} week... 阅读全文
posted @ 2008-01-09 00:21 万一 阅读(7337) 评论(0) 推荐(0)