In message 20010310012841.A3478@esmeralda.gerwinski.de Peter Gerwinski writes:
David James wrote:
Have there been any changes in the packing of data in records or packed records between 19991030 and 20010306? Or any changes in the data transfer between variables and typed files (is that the correct name? I mean FILE OF Twhatever, where Twhatever is a TYPE defined in the source)?
I am not aware of any.
But do not rely too much on such things since they might change, for instance, when new types of processors show up.
My need is that I have FILEs of Twhatever that have been written by executables compiled under GPC 19991030 and I now want to read them using executables compiled under GPC 20010306.
Now I'd like to report a difference in this area (actually in the in-memory usage) between GPC19991024 and GPC20010306:
The following program:
program test9(input,output); const maxnum=4; TYPE T1=RECORD a1:array[1..maxnum] of byte; END; T2=RECORD a2:packed array[1..maxnum] of byte; END; T3=RECORD a3:packed array[1..maxnum] of 0..255; END; T4=RECORD a4:array[1..maxnum] of 0..255; END; begin writeln('t1: ',sizeof(t1):1); writeln('t2: ',sizeof(t2):1); writeln('t3: ',sizeof(t3):1); writeln('t4: ',sizeof(t4):1); end.
gives
t1: 4 t2: 4 t3: 16 t4: 16
under GPC20010306, and gives 4,4,4,16 under GPC19991030.
That is the PACKED ARRAY of 0..255 occupied 4 bytes under the old version and now occupies 16 bytes. Whilst I clearlyu have a workaround by switching from 0..255 to byte, that behaviour doesn't seem right to me.