我在Delphi2007应用程序中有以下代码:
function TBaseCriteriaObject.RecursiveCount(
ObjType: TBaseCriteriaObjectClass): integer;
var
CurObj: TBaseCriteriaObject;
begin
result := 0;
{$WARNINGS OFF}
for CurObj in RecursiveChildren(ObjType) do
Inc(Result);
{$WARNINGS ON}
end;
这会产生此警告:
[DCC Warning] BaseCriteriaObject.pas(255): H2077 Value assigned to 'CurObj' never used
我理解警告,但不想更改代码,因此如何消除警告,因为在这种情况下,$warnings off似乎不起作用?