[Lazarus] Typecast set to byte in mode OBJFPC

Jürgen Hestermann juergen.hestermann at gmx.de
Wed Dec 31 17:33:18 CET 2014


Am 2014-12-31 um 17:30 schrieb Jürgen Hestermann:
>
> Am 2014-12-31 um 16:55 schrieb Joost van der Sluis:
>> On 12/31/2014 04:40 PM, Jürgen Hestermann wrote:
>>> type FlagType        = (Flag1,Flag2);
>>>           FlagSetType   = set of FlagType;
>>> var i : SizeInt;
>>>        S : FlagSetTyp;
>>>
>>> S := [Flag1];
>>> i := byte(S); // <---- Error "illegal type conversion"
>>
>> i := ord(S); ?
>>
>> But it's still invalid, though. A set can contain more then 32 items, and then your conversion does not hold anymore.
>
> It seems that now FlagType is always 4 bytes in size while it was 1 byte in DELPHI mode.
> That's a real problem because I have stored (and reread) these sets from a binary file
> which now fails because of the larger set size.
> Is this realy compiler mode dependent?
> I can't find any documentation about this.
Sorry, I meant that FlagSETType seems to be 4 bytes now.




More information about the Lazarus mailing list