[fpc-devel] WordBool or SmallInt ?
Martin Frb
lazarus at mfriebe.de
Fri Dec 29 20:38:53 CET 2023
fpc 3.2.3
The below prog prints 3 times: 11, -1 (signed values)
https://www.freepascal.org/docs-html/current/ref/refsu4.html#x26-250003.1.1
> Free Pascal also supports the ByteBool, WordBool, LongBool and
> QWordBool types. These are of type Byte, Word, Longint or Int64,
Besides the fact that a "QWordBool" should be "Int64", they all seem to
be treated as signed.
Yet at least the first two of them are documented as unsigned.
program Project1;
var
b1,b2 : wordbool;
b3,b4 : longbool;
b5,b6 : qwordbool;
begin
b1 := wordBool(11);
b2 := wordBool(-1);
writeln(ord(b1));
writeln(ord(b2));
writeln;
b3 := LongBool(11);
b4 := LongBool(-1);
writeln(ord(b3));
writeln(ord(b4));
writeln;
b5 := qwordBool(11);
b6 := qwordBool(-1);
writeln(ord(b5));
writeln(ord(b6));
readln;
end.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20231229/a167764a/attachment.htm>
More information about the fpc-devel
mailing list