As far as the compiler is concerned what’s the difference between clearing an 
array using a for-loop vs. FillChar? It seems like iterating the array would be 
slower but what does FillChar do exactly and is it faster? The primary concern 
here is that the memory originally allocated (using SetLength right?) remains 
in the same location.

var
  list: array of integer;

SetLength(list, 10);

for i := 0 to high(list) do
  list[i] := 0; 

FillChar(list[0], Length(list) * sizeof(integer), 0);


Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to