[fpc-pascal] Initializing record variables
Marc Santhoff
M.Santhoff at t-online.de
Fri Nov 10 18:34:42 CET 2006
Am Donnerstag, den 09.11.2006, 19:52 -0700 schrieb list at moz.geek.nz:
> > 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:
>
> type
> TRoleDetails = record
> Name, Descr: String;
> end;
>
> const
> 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.
I see. if other approaches fail this at least gives me some hook for
applying regular expressions. That should help recucing the amount of
work.
Thanks,
Marc
More information about the fpc-pascal
mailing list