[fpc-pascal] H2pas tool vs others, C header translation
Dmitry Boyarintsev
skalogryz.lists at gmail.com
Mon Aug 28 00:47:11 CEST 2017
Is 2 neither true, nor false? 3? 4?
If false is zero,
Then true is not false.
Also C doesn't have a boolean type per se. Iirc it was introduced in some
version of c++ standard.
In C it's very strange to see code like that:
If (b==1)
It's always
If (b)
Or
If (!b)
On Sunday, August 27, 2017, <noreply at z505.com> wrote:
> On 2017-08-27 06:22, Dmitry Boyarintsev wrote:
>
>> On Sun, Aug 27, 2017 at 2:37 AM, <noreply at z505.com> wrote:
>>
>> Why borland chose the bool to not be 100 percent compatible, and
>>> only 50 percent compatible?
>>>
>>> Bool in delphi:
>>> true = -1
>>>
>>> Bool in C:
>>> true = ($FFFFFFFF) 1
>>>
>>> Why not just make it exactly compatible, there must be some
>>> underlying (possibly obnoxious) reason for this mess.
>>>
>>
>> They are compatible, if you declare like this:
>>
>> true = (not false);
>>
>>
> Depends, AFAIK, if the C library checks for an exact value of 1 somewhere,
> when Delphi/FPC sends in a -1, this could cause problems, but I haven't
> thought about it enough.
>
> I just don't see why both languages could not just agree to use "1", they
> must have had some reason, strange or not.
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170827/4c07c984/attachment.html>
More information about the fpc-pascal
mailing list