我Incompatible types: 'PPointerList' and 'TPointerList'在跟随功能时遇到错误.
function MyFunction: PPointerList;
begin
result := FList.List;
end;
Run Code Online (Sandbox Code Playgroud)
FList.List返回TPointerList类型.这段代码在Delphi 7代码中工作正常但在Delphi XE4中抛出错误.
PPointerList和TPointerList在System.Classes中声明
在System.Classes中
PPointerList = ^TPointerList;
TPointerList = array of Pointer;
Run Code Online (Sandbox Code Playgroud)
当我将TPointerList转换为PPointerList时,它就像是一样
function MyFunction: PPointerList;
begin
result := PPointerList(FList.List);
end;
Run Code Online (Sandbox Code Playgroud)
这是正确的解决方案,或者我应该怎么做才能摆脱这个错误.
TList已经改变.内部领域FList曾经是PPointerList现在但现在TPointerList.要返回指向它的指针,可以使用:
function MyFunction: PPointerList;
begin
Result := @FList.List;
end;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
810 次 |
| 最近记录: |