[fpc-pascal] LongBool True = -1
Sven Barth
pascaldragon at googlemail.com
Sun May 20 10:21:40 CEST 2018
Dmitry Boyarintsev <skalogryz.lists at gmail.com> schrieb am So., 20. Mai
2018, 04:38:
> On Thu, May 17, 2018 at 5:26 PM, Anthony Walter <sysrpl at gmail.com> wrote:
>
>> I am working with some a glib library that expects gboolean to be
>> positive 1 for true, yet FPC emits -1 for true.
>>
>
> I'd think that pascal defines true as
> true = not false;
> In case of unsigned integers "-1" is not an option
>
FPC defines True as 1 for Boolean, Boolean16, Boolean32 and Boolean64 and
as "-1" aka "all bits 1" for Byte Book, WordBool, LongBool and QWordBool.
And for unsigned integers "-1" is converted to "all bits 1" as well though
one needs to use a typecast (see the declaration of INVALID_HANDLE_VALUE
for example).
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180520/18d9e832/attachment.html>
More information about the fpc-pascal
mailing list