I have a weird issue when converting code from Delphi 7 to 2010. It has to do with records. The record defined below, when sized in D7, is 432 bytes, and in D2009 (and 2010) it's 496. I know, that an easy solution is to make it a packed record, then all versions come out to 426 bytes... However, we have data stored where we streamed the record and now we are trying to read those streams with a newer language.
TToTry = Record
a,b,c,d : Extended;
e,f,g,h : Extended;
i : String[15];
j,k,l,m,n,o,p,q,r,s,t : Array[1..3] of Extended; End;
In investigating this issue, I created another record, and, for whatever reason, the sizes are the same? The record is smaller, but it has the same data types. but it comes out the same size in all versions of the language.
TMyRecord = Record
Ext1 : Extended;
Ext2 : Extended;
Ext3 : Extended;
Ext4 : Extended;
Ext5 : Extended;
Ext6 : Extended;
Int1 : Integer;
Int2 : Integer;
char1 : AnsiChar;
char2 : AnsiChar;
MyString : String[15];
Arr1 : Array[1..3] of Extended;
Arr2 : Array[1..3] of Extended; end;
Anybody have any insight as to why one record is so different, and the other is the same? Something to do with byte boundary alignments in Delphi for sure. but what changed so drastically from one version to the next?