1 high与low
high(X)函数,low(X)函数
当X为数组时,high(X)返回数组下标的最大值,即元素个数-1。如果数组为空,则返回值为-1
当X为数组时,low(X)返回0
如果X为二维数组,则可以把其中的一维数组作为元素。
2 字符相关的变量类型转换
var
s: string;
p: pchar;
buf: array[0..100] of char;
(1)string转pchar
p := PChar(s);
(2)pchar转string
s := p;//隐形转换
(3)string转字符数组
strcopy(buf, pchar(s));
(4)字符数组转string
s := buf;//(同2 /隐形转换)
(5)字符数组转pchar
p:= buf ///隐形转换
(6)pchar转字符数组
strcopy(buf, p);
动态链接库
创建dll中的函数名大小写应该与使用时声明的大小写保持一致,否则会出现无法定位程序入口点
编译(生成proj1)
dcc32 proj1.dpr
执行
proj1
关于常量const
常量可以定义为
const
d1 = 100;
或者
const
d2: integer = 200;
两种类型都是允许的,但是第二种方式导致了该变量不能作为定义子界类型时的边界值。
可能的原因是:第一种方式,在预定义时已经被替换为立即数。第二种方式,在运行时才替换为立即数;而定义数据类型所使用的值必须是立即数或者等效于立即数
关于private
The truth is that in Object Pascal the private access specifier is actually enabled only between
different units, As we will see, this is also true for classes.