[fpc-pascal] Sets

Sven Barth pascaldragon at googlemail.com
Wed Oct 2 21:50:08 CEST 2013


On 02.10.2013 19:09, Juha Manninen wrote:
> If I have have a set with < 9 elements, like :
>
> type
>    TMyEnum = (
>      xOne,
>      xTwo,
>      xThree,
>      xFour,
>      xFive
>    );
>    // Count <= 8, fits in one Byte
>    TMyEnums = set of TMyEnum;
>
> then in Delphi a variable of that type can be casted to Byte. Other
> casts don't work.
> In FPC I must cast it to Integer!
> Does it really mean that all sets in FPC reserve at least 32 bits? Is
> it documented? I did not find it as "Set" gives so many false matches.

It's documented in the language reference guide: 
http://freepascal.org/docs-html/ref/refsu20.html#x44-510003.3.3

And as Peter already mentioned there is $PACKSET: 
http://freepascal.org/docs-html/prog/progsu61.html#x67-660001.1.61

Regards,
Sven



More information about the fpc-pascal mailing list