Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 1 of 1 total
Thread Kerblooey!
Tue, Jun 20 2017 8:24 AMPermanent Link

Matthew Jones


var
anFieldOrder : array of integer;
begin

   SetLength(m_anFieldOrder, nOrderMax);
   for nLoop := 0 to Length(anFieldOrder) do
   begin
       anFieldOrder[nLoop] := nLoop;
   end;

Spot the deliberate mistake! This (at least with a member variable), will blow Chrome out of the water, and kill the debugger.

I was converting it from constants to use the Length, but it should be "Length(anFieldOrder) - 1" otherwise it keeps going until it blows up.

I do ponder whether the for loop should only evaluate the terminator once, but maybe it thinks it is a function so wants to allow changes.

Easy to spot [!] and fix of course.

--

Matthew Jones
Image