[fpc-pascal] BoolToStr
Ralf Quint
freedos.la at gmail.com
Sun Aug 28 20:45:12 CEST 2022
On 8/28/2022 8:23 AM, James Richters via fpc-pascal wrote:
> Running "i:\booltostr.exe "
>
> -1
>
> 0
>
> Why true is -1 instead of 1 is beyond me, but anyway, I would consider
> this BoolToInt, not BoolToStr,I want the Strings ‘TRUE’ or ‘FALSE’ as
> indicated in the documentation
>
Very logical in fact. 0 is NO bit set in any given size of boolean data
type, -1 means ALL bits set on that same size boolean data type. And a
check on TRUE or FALSE, can easily be done with checking the sign flag
of a processor rather than doing actually any bit fiddling (at least on
those CPUs that I am familiar with).
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20220828/8da82fcc/attachment-0001.htm>
More information about the fpc-pascal
mailing list