<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<blockquote cite="mid:20140722220135.8CC397306B@toad.stack.nl"
type="cite">
<pre wrap="">
But does that work in Delphi, did you test?
</pre>
</blockquote>
<br>
You are correct - Delphi also requires that source and target are of
same size - thanks!<br>
<br>
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<br>
every file - so I used -Mdelphi in the fpc command line - it <br>
<br>
program setcast;<o:p></o:p>
<p class="MsoNormal"><o:p> </o:p>type<o:p></o:p><br>
tenum = 0..63;<o:p></o:p><br>
tmyset= set of tenum;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p>var x:int64;<o:p></o:p><br>
y:tmyset;<o:p> <br>
</o:p></p>
<p class="MsoNormal"> begin<o:p></o:p><br>
writeln(sizeof(tmyset));<o:p></o:p><br>
x:=int64(y);<o:p></o:p><br>
y := tmyset(x);<o:p></o:p></p>
end.<br>
<br>
If you compile this program "fpc -Mdelphi setcast.pas" - it will not
complile :(<br>
But if you add {$mode delphi} - it will :)<br>
<br>
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<br>
Do you know why -Mdelphi is different from {$mode delphi} w.r.t to
sizeof(tmyset)?<br>
<br>
Thanks, <br>
Gennady<br>
<br>
<br>
</body>
</html>