[Lazarus] Typecast set to byte in mode OBJFPC

Joost van der Sluis joost at cnoc.nl
Wed Dec 31 16:55:12 CET 2014


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.

Joost.





More information about the Lazarus mailing list