[fpc-devel] How to convert set to integer and vice versay

thaddy at thaddy.com thaddy at thaddy.com
Tue Jul 22 18:22:32 CEST 2014


Yes, Marco, as you previously suspected, It does.
I saw you gave already a similar answer to mine.

The pointer casts are definitely not necessary, Gennady.

Can you show a little example WHERE it doesn't work? In plain fpc, not 
lazarus code?


On 22-7-2014 18:13, Marco van de Voort wrote:
> In our previous episode, Gennady Agranov said:
>>> Good. And afaik in Delphi mode this works too in FPC? Did you test?
>>>
>> casting integer to set does not compile in FPC - and yes - I use Delphi
>> mode :(
> program setcast;
>
> {$ifdef FPC}
> {$mode delphi}
> {$else}
> {$APPTYPE CONSOLE}
> {$endif}
>
> uses
>    SysUtils;
>
> type tenum=0..31;
>       tmyset= set of tenum;
>
> var x:integer;
>      y:tmyset;
>
> begin
>    x:=integer(y);
> end.
>
> compiles in both FPC (both 2.6.x and trunk) and Delphi (XE4)
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list