Delphi disable warnings fails
Posted
by Alan Clark
on Stack Overflow
See other posts from Stack Overflow
or by Alan Clark
Published on 2010-05-08T06:34:29Z
Indexed on
2010/05/08
6:38 UTC
Read the original article
Hit count: 335
delphi
|compiler-warnings
I have the following code in a Delphi 2007 application:
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;
Which produces this warning:
[DCC Warning] BaseCriteriaObject.pas(255): H2077 Value assigned to 'CurObj' never used
I understand the warning but don't want to change the code, so how do I get rid of the warning because {$WARNINGS OFF} does not seem to work in this case?
© Stack Overflow or respective owner