我正在将一些代码从 Delphi 5 迁移到现代平台。目前我有编译后的代码(在我的环境中工作)和源代码(在我的环境中无法编译)。这意味着我无法通过更改或插入断点或转储值来真正试验代码。在查看一段特定的代码时,我看到一个过程 (ProcedureA) 正在调用另一个过程 (ProcedureB) 并传入必须通过引用的参数,否则 ProcedureB 将不起作用。我的理解是必须在过程的参数列表中的参数中添加 var 前缀,以便它们通过引用传递,但这里没有这样做。但是,其中一个参数是 TList 类型,我知道它本质上是一个指针数组。我的问题是:
这是代码:
Procedure ProcedureB(PartyHeaderInformationPtr : PartyHeaderInformationPointer;
PartyHeaderTable : TTable;
_PrisonCode : String;
_FineType : TFineTypes;
PartyHeaderInformationList : TList);
begin
with PartyHeaderInformationPtr^, PartyHeaderTable do
begin
AssessmentYear := FieldByName('TaxRollYr').Text;
PartyType := FieldByName('PartyType').Text;
PartyNumber := FieldByName('PartyNo').AsInteger;
PrisonCode := _PrisonCode;
FineType := _FineType;
end; {with PartyHeaderInformationPtr^ ...}
PartyHeaderInformationList.Add(PartyHeaderInformationPtr);
end; {AddPartyHeaderPointerInformation}
{=================================================================}
Procedure ProcedureA(PartyHeaderTable : TTable;
PartyDetailTable : TTable;
PartyHeaderInformationList : TList);
var
Done, FirstTimeThrough : Boolean;
PrisonPartyFound, JunglePartyFound : Boolean;
PrisonPartyYear, …Run Code Online (Sandbox Code Playgroud)