Dear friends,
It turns out I have been too optimistic.
I had two thoughts:
1) I can unpack/repack the structures and work on them. FALSE! Here I have records, not arrays!
2) I cannot assign the array of chars in a single instruction, but I can assign a single char: all I need is a loop. FALSE! My situation is in effects more problematic, probably because also some of the sub-structures are packed... See below
These are the declarations I have (stripped down)
TYPE
ITEN = packed RECORD KEY :PACKED ARRAY [1..MAX] OF CHAR; PUNT:integer; END;
ND = packed RECORD POS : integer; IDX : packed ARRAY [1..ONDM2] OF ITEN; END;
VAR DATA : ND;
This assignment fails:
DATA.IDX[H1].KEY:= <array of char>;
I thought I could loop through this assignment: DATA.IDX[H1].KEY[x] := <char>; But it still fails. The compiler says: Error: cannot take address of packed record field `IDX'
BUT if the problem is with IDX, why this assignment is ok??? DATA.IDX[H1].PUNT := <integer>;
At the moment, the workaround I have found is:
VAR DATA : ND; TMP : ITEN;
TMP:=DATA.IDX[H1]; TMP.KEY:=<array of char>; DATA.IDX[H1]:=TMP;
I cannot really understand why (and if) this should be safer (from the compiler's poin of view) than doing DATA.IDX[H1].KEY:= <array of char>;
Any thought? Ciao Francesco Bonomi
Francesco Bonomi Si.lab s.r.l. Via Citille 13 50022 Greve in Chianti FI- Italy
Tel +39 - 055 8544805 Fax +39 - 055 8547418
http//:www.silab.it