[fpc-pascal] Initializing record variables

list at moz.geek.nz list at moz.geek.nz
Fri Nov 10 03:52:04 CET 2006

> particle_t = record
> 		name: array [0..Pred(16)] of char;
> 		longi: integer;
> 		pressure: float;
> 		temperature: double;
> 		lati: integer;
> 	end;
> ibuf: array [0..Pred(2)] of particle_t;

> (* raw translation by automatic tool *)
> ibuf:=(('zero'#0,0,0.0f,0.0,0),('zero'#0,0,0.0f,0.0,0));

This should work:

  TRoleDetails = record
    Name, Descr: String;

  cRoles: array[1..3] of TRoleDetails = (
    (Name: 'zEditRole'; Descr: 'z Edit role descr'),
    (Name: 'yEditRole'; Descr: 'y Edit role descr'),
    (Name: 'xEditRole'; Descr: 'x Edit role descr')

You need to name the elements, and they need to be in the order they're
declared in the record.


More information about the fpc-pascal mailing list