[fpc-devel] WordBool or SmallInt ?

Sven Barth pascaldragon at googlemail.com
Sat Dec 30 00:47:34 CET 2023


Martin Frb via fpc-devel <fpc-devel at lists.freepascal.org> schrieb am Fr.,
29. Dez. 2023, 20:38:

> 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.
>

The prefix refers to the width, not whether they are signed or not.


> Yet at least the first two of them are documented as unsigned.
>

Internally they are handled as signed, but in the end it doesn't matter,
because the only thing that counts for them is whether they're "0" aka
"False" or "not 0" aka "True" (though that doesn't mean that all bits need
to set, just that any bit needs to be 1).

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20231230/3433870c/attachment.htm>


More information about the fpc-devel mailing list