Why cannot allocate more than 19??

Quote
Benjy wrote in message <01bde6a2$f9579940$6e2bbcca@jerryngu>...
>Hello again,

>I got my program to work, but I don't know why it won't work properly
if I
>allocate the Name part of the record to more than [19]. If I put

>Name:String[20];

>the program would just crash together with my Turbo Pascal program.
Can
>anyone of you expert out there enlighten me?? Thanks

Well, after guessing the last bug COMPLETELY wrong (New_Node is a
_Pointer_?! doh - doesn't have to be Var so) I had to check this one
out.

Step through the first insertion in the list, with the pointer List in
a watch window. You get to
    if (not Duplicate) then
    Begin
         if (Prev=Nil) then
         Begin
              List^.Prev:=New_Node;
              New_Node^.Next:=List;
              List:=New_Node;
         end

Now, at the assignment to List^.Prev, List is still NIL. So List^.Prev
does not exist, and you corrupt something. Actually, you corrupt 4
bytes, and with a 19-char string, I get the address as being 0:$1C,
which is the vector for interrupt INT 07 - CPU-generated (80286+) -
PROCESSOR EXTENSION NOT AVAILABLE according to Ralf Brown's Interrupt
List. Presumably this interrupt does not happen often. But if you make
the string a char longer, you corrupt the last 3 bytes of this vector
and the first of the next one, which is INT 08 - IRQ0 - SYSTEM TIMER;
CPU-generated (80286+) according to the same source, and that happens
a lot so you crash.

FP