Christian Bockermann wrote:
Hello everyone !
Hiya.
var x : RECORD CASE Boolean OF False :( rec:Record name : String[3]; number : integer; end); true :( field:packed array [0..47] of boolean ); end;
If you do a writeln(sizeof(x)); you'll find GPC is making this a lot longer than 6 bytes long -- it shows up as 16 on my system. I think this has to do with the other fields that GPC uses for the string type (e.g. .Capacity), although that doesn't explain all of the length and even with a 128 bit field I don't see much. I'm sure someone else (Peter?) knows what is going on.
I was able to get the code to do something intelligible If I change your record definition to: [...] rec: packed record name : packed array[0..2] of char; number : integer(16); [...] field:packed array [0..39] of boolean
and fixed the loop to go through 40 bits.
I get a nice little 5 byte structure and the output is: binary decoding : 10000010 01000010 00000100 10010000 00000000 Note that the end of the byte is different as the left most bit is the 1 bit -- gpc fills in a space for the undefined character, and you loose the length field because I used a standard Pascal string.
Hope that is of some help, -Kevin
-- Kevin A. Foss --- kfoss@mint.net --