在 Delphi 7 或 Delphi XE 下编译时,下面的代码会报错
[DCC Error] Project1.dpr(25): E2010 Incompatible types: 'array of Char' and 'TAChar'
根据Rudy的文章,应该允许将类型化数组传递给开放数组吗?
此外,为什么它不抱怨 'array of Boolean' 和 'TABoolean' ?
非常感谢您的帮助!
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
type
TAChar = array of Char;
TABoolean = array of Boolean;
procedure Test1(const CharArr: array of Char);
begin
end;
procedure Test2(const BoolArr: array of Boolean);
begin
end;
var
Arr1: TAChar;
Arr2: TABoolean;
begin
try
Test1(Arr1); // <------- Does not compile in Delphi 7 & XE
Test2(Arr2);
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.