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!

Debug Issue Problem with booleans in Local Variables window

Status
Not open for further replies.

JES1904

Programmer
Jul 7, 2008
36
US
I have a test in a method that reads class wide integer properties of front (= 35) & back (= 30)


Code:
procedure runcheck (iscomplete : boolean);
begin
  iscomplete := front > back;
end

Procedure DoSomething;
var
  done : boolean
Begin
  done := false;
  Repeat
    runcheck (done);
  Until done;
End;
When I call Dosomething I get stuck in a loop because the runcheck always evaluates false even though the values I am testing are 35 > 30 which should result in true. This is bad enough, but I am trying to monitor variable values in the debugger local variable window and it is showing the front and back variables at 35 & 30, but will not show me the values for the booleans when I step through the program in debugger. The local variable wibndow tells me that the value is not available due to optimization. I have visited the Project/options/compiler settings and turned optimization off and checked Complete Boolean Eval on without any change in the local variable window report.

Any suggestions or insights please!@
 
Try
code]
procedure runcheck ([red]var[/red] iscomplete : boolean);
[/code]
or return true or false from runcheck
Code:
function runcheck: boolean;
begin
  Result := front > back;
end

procedure DoSomething;
var
  done : boolean
begin
  done := false;
  repeat
    done := runcheck;
  until done;
end;

This is obviously fake code, so any answers you get could be irrelevant to the problem you actually have.

Fake code := fake answers
Real code := real answers

Lee
 
Thanks,

I gave fake code because the actual code was pretty extensive. Your suggestion worked. I forgot that not defining the type of parameter behaved as a Const parameter instead of as a Var parameter. Apparently this confuses the debugger and it will not monitor the values for booleans. I also appears that the compiler gets confused regarding evaluation of boolean expressions because, in the actual code, an the statement IF front > back THEN also failed to move to the next line and execute the code for true later in the same procedure.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top