[fpc-pascal] Array initialization

J├╝rgen Hestermann juergen.hestermann at gmx.de
Wed Mar 18 18:33:33 CET 2009

>> FillChar(Values,SizeOf(Values),0)
> That worked.
> However, for an integer is fillword better?

A "fillword" procedure does not exist. FillChar is an anchient Pascal 
function to simply fill any arbitrary memory location of any size 
(determined by a variable) with all the same byte. It is very fast but 
there is no type checking at all (you can fill any type of variable) and 
I think there is no range checking either. So you should use SizeOf() to 
  give the number of bytes to be written but in special circumstance you 
can also use a different value.

A similar procedure is move, which copies bytes from one memory location 
to another (again both determined by variables) also without type and 
range checking.

Ju"rgen Hestermann.

More information about the fpc-pascal mailing list