Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incorrect warning message

Status
Not open for further replies.

TheDog6

Programmer
Sep 2, 2007
1
0
0
ES
Hi, I've put it in Helpful tip for no other option. With this code:

function FillRFIndexes(rfindexes:pInteger):Integer;
var
i:Integer;
z:pinteger;
begin
Result:=0;
z:=rfindexes;
if rfindexes=nil then
exit;
for i:=0 to {some}.Count-1 do
begin
if {some condition} then
begin
Inc(Result);
try
rfindexes^:=i;
Inc(rfindexes,sizeof(Integer));
except
Result:=0;
break;
end;
end;
end;
rfindexes:=z;
end;

The compiler warns 'Value assigned to rfindexes never used'. It's not correct, because the rfindexes value it is used in the function return. It's a delphi 7 issue.
 
??? what's your point here.
the compiler gives a valid warning since I don't see
Result := rfindexes^;

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
if you want to return the value of z to the calling code, you'll need to declare the function as
Code:
function FillRFIndexes([b]var[/b] rfindexes:PInteger):Integer;

or, return your result by changing the last line to
Code:
rfindexes^ := z^;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top