[comp.lang.pascal] TP 5.5 - weird error

shepard@bsu-cs.bsu.edu (Brett Shepard) (06/07/90)

HELP!!!

I've written to following code (in Turbo Pascal 5.5), which makes sense to me,
but fails to execute.  A trip through the debugger (Turbo Debugger 1.0) has 
shown me the error, but I can't figure out why I'm getting the error.

Var
  FDT, I : Integer; 
Begin
  FDT := 1;
    For I := 1 to 2 do
      For S := H to C do       { S in an enumerated type - H, D, S, C} 
        For P := 1 to 14 do    { P is an enumerated type - 1..14} 
          Begin
            FD[FDT].P := P;
            FD[FDT].S := S;
            Inc(FDT);
          End;  { for P }
End;  {procedure }

The problem occurs when FDT reaches 107 (6Bh), after the next time through the
Inc() statement, FDT is set to 11 (Bh).  Thinking that the error, for some 
strange reason, might be in the Inc() procedure, I changed the line to read:  
FDT := FDT + 1; 
that didn't make any difference, the value still went from 107 to 11.

I am totally confused by these proceedings and would greatly appreciate _any_
comments or assistance. 

Thanks, 

Brett


BTW - please e-mail.  I don't get to read this group very often.  Thanks.

-------------------------------------------------------------------------------
"Just the opinions, ma'am."  |   Brett Shepard         | Close your eyes and 
Go ahead, crash our system!  |   Ball State University | pretend that there is
UUCP:  shepard@bsu-cs.bsu.edu|   Muncie, IN            | a fancy graphic here
-------------------------------------------------------------------------------

shepard@bsu-cs.bsu.edu (Brett Shepard) (06/08/90)

I've already gotten a couple of responses to my question about the TP 5.5
error.  The two people suggested that my array was not large enough.  Now
that I think about it - they're right!    

It's amazing what can happen when someone else looks at your code.

Thanks for your help.


-------------------------------------------------------------------------------
"Just the opinions, ma'am."  |   Brett Shepard         | Close your eyes and 
Go ahead, crash our system!  |   Ball State University | pretend that there is
UUCP:  shepard@bsu-cs.bsu.edu|   Muncie, IN            | a fancy graphic here
-------------------------------------------------------------------------------