Change in packing

Martin Liddle martin at tcs02.demon.co.uk
Sat Dec 1 00:33:09 CET 2001


In article <0kxzRuCDU3B8Ew1j at tcs02.demon.co.uk>, Martin Liddle
<martin at tcs02.demon.co.uk> writes
>In article <200111300132.CAA14769 at goedel.fjf.gnu.de>, Frank
>Heckenbach <frank at g-n-u.de> writes
>>> My main problem is that the packing of records appears to have changed.
>>
>>I've changed a number of things WRT sets. Maybe one of them is
>>responsible for what you observe, maybe not ...
>>
>OK.  I'm working on a pair of test programs to demonstrate the behaviour
>I see.  My initial efforts work perfectly (i.e. don't show the problem) so I
>obviously haven't got to grips with the real problem yet.
>>
Sorry to take so long but its taken me all day to work exactly what is
triggering the problem.

The first program simply writes a data file and performs as expected.
The second program reads the data back.  Under 20010604 it performs as
expected.  Under 20011123 the values for class are 513, 1026 and 2051.
For the problem to be shown then it is necessary for the definitions to
be in a separate unit.  If the definitions and procedures are in the
main body of the program then everything works correctly.

=================================

Program TCS_Test2;
Type TCompr=Packed Record
      AClass:1..40;
      Awel:Set of 1..120;
     End;
Var J:Integer;
    AFile:File [1..3] of TCompr;
Begin
 Rewrite(AFile,'TCS_test');
 For J:=1 to 3 Do
  Begin
   SeekWrite(AFile,J);
   With Afile^ Do
    Begin
     AClass:=J;
     Awel:=[J];
    End;
   Put(AFile);
  End;
 Close(AFile);
End.

==========================================
Program TCS_Test3;

Uses TCS_test3U;

Begin
 Reset(AFile,'TCS_test');
 For J:=1 to 3 Do
  Begin
   With Afile^ Do
    Begin
     Write(' Class: ',AClass:2,' Awel: ');
     For K:=1 To 40 Do If K in Awel then Write(K,' ');
     Writeln;
    End;
   Get(AFile);
  End;
 Close(AFile);
End.

===============================================

Unit TCS_test3u;

Interface

Type TCompr=Packed Record
      AClass:1..40;
      Awel:Set of 1..120;
     End;
Var J,K:Integer;
    AFile:File [1..3] of TCompr;

Implementation

End.


-- 
Martin Liddle, Tynemouth Computer Services, 27 Garforth Close,
Cramlington, Northumberland, England, NE23 6EW.
Phone: 01670-712624.  Fax: 01670-717324.
Web site: <http://www.tynecomp.co.uk>.




More information about the Gpc mailing list