Hello,
Again a Delphi incompatibility is found! At least with Delphi 3. Essence: the internals of longbool, wordbool and bytebool types in FPC aren't the same as in Delphi 3. That causes serious problems by porting Delphi code with typecastings like word(a_wordbool_variable), e.g. by calculating of index offsets in arrays!
A sample which demonstrates differences between FPC and Delphi 3:
{$ifdef fpc}
{$mode delphi}
{$endif}
{$apptype console}
const
x:longbool=true;
y:wordbool=true;
z:bytebool=true;
w:boolean=true;
begin
writeln(longint(x),' ',word(y),' ',byte(z),' ',byte(w));
end.Output:
1) sample is compiled by FPC:
1 1 1 1
2) sample is compiled by Delphi 3:
-1 65535 255 1
Cause (only essence, I did not search details in compiler source): Delphi 3 sets ALL bits in variable to binary 1 if the variable value will be true and its type is longbool, wordbool or even bytebool (unlike boolean). Unlike Delphi, FPC uses actually only one bit.
Sincerely, Pavel
