我有这种类型:
type
pTRegex_sec=^TRegex_sec;
TRegex_sec = record
secs: Array of pTRegex_sec;
len: byte;
hasSections: boolean;
hasUnits: boolean;
units: Array of TRegex_unit;
end;
type TRegex_assertions = record
len: byte;
secs: Array of TRegex_sec;
end;
我想为 TRegex_sec 类型分配内存:
var Assertions: TRegex_assertions;
begin
setlength(Assertions.secs, 1);
GetMem(Assertions.secs[0], SizeOf(TRegex_sec));
end;
我遇到的错误是“不兼容的类型”:Assertions.secs[0]<-- here
另一个尝试,同样的错误:
New(Assertions.secs[0]);
如何正确执行?