[fpc-pascal] variant part of a record

Vinzent Höfler JeLlyFish.software at gmx.net
Wed Sep 20 02:10:53 CEST 2006


Пётр Косаревский wrote:
>> Yes, you do. :)
>> Nevertheless
>>    some_type = record
>>       case Something : byte of
>>       1: (x,y: word);
>>       2: (z: longword);
>>    end;
> 
> Thank you, Jonas and Vincent, but I was vague: what I want is blockread'ing, so I have to use
>   record
>   Something: byte;
>    case byte of
>     1: (x,y: word);
>     2: (z: longword);
>   end;

No, AFAIK you don't have to, it's the same, just a different syntax. 
Your "Something" byte discrimant will be there. Or where else do you 
think it is stored within the structure?

Probably you should used a "packed record", though. And it's in no way 
portable, of course.


Vinzent.




More information about the fpc-pascal mailing list