[fpc-pascal] Static Initialisation of Arrays

Jürgen Hestermann juergen.hestermann at gmx.de
Mon Jun 28 18:17:47 CEST 2010



Paul Michell schrieb:
> I realise that 'Array Of Single' declares a dynamic array, but is there 
> any equivalent syntax for static data arrays in the same way that 
> strings litterals are in effect, variable length static declarations.

You have to realize, that dynamic arrays are actually pointers (to the array and other administration data). So you cannot define anything to such arrays at declaration time because no memory is assigned to this pointer yet. You have to use setlength to assign memory at runtime (just as getmem would do) and only then you can fill it with data.



More information about the fpc-pascal mailing list