[fpc-devel] How to convert set to integer and vice versay
Gennady Agranov
gennadyagranov at gmail.com
Wed Jul 23 05:54:58 CEST 2014
> But does that work in Delphi, did you test?
You are correct - Delphi also requires that source and target are of
same size - thanks!
I finally figured why existing Delphi code was not compiling - I did not
use {$mode delphi} in the unit - i did not want to add {$mode dlephi} to
every file - so I used -Mdelphi in the fpc command line - it
program setcast;
type
tenum = 0..63;
tmyset= set of tenum;
var x:int64;
y:tmyset;
begin
writeln(sizeof(tmyset));
x:=int64(y);
y := tmyset(x);
end.
If you compile this program "fpc -Mdelphi setcast.pas" - it will not
complile :(
But if you add {$mode delphi} - it will :)
And I know why - if you have {$mode delphi} - sizeof(tmyset) is 8, but
if you do not (and use -Mdelphi) sizeof(tmyset) is 32
Do you know why -Mdelphi is different from {$mode delphi} w.r.t to
sizeof(tmyset)?
Thanks,
Gennady
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140722/0c9c8db2/attachment.html>
More information about the fpc-devel
mailing list