[fpc-pascal] H2pas tool vs others, C header translation

Sven Barth pascaldragon at googlemail.com
Sat Aug 26 14:30:38 CEST 2017


On 26.08.2017 13:43, Michael Van Canneyt wrote:
> 
> 
> On Sat, 26 Aug 2017, Sven Barth via fpc-pascal wrote:
> 
>>>
>>> I did read it.
>>>
>>> I think the programmer *must* worry about the details and must
>>> definitely
>>> NOT use the booleans for anything C related. That was my point.
>>>
>>> Attempting to cater for C code using BOOL or whatever type is misplaced.
>>> C does not have a boolean type.
>>>
>>> The standard says for "if" :
>>>
>>> "In both forms, the first substatement is executed if the expression
>>> compares unequal to 0."
>>>
>>> Treat it as such.
>>
>> And I say that the programmer does not need to care about it if the one
>> that translated the interface used the correct type.
> 
> And this "if" is the cliff on which the ship crashes and sinks...

But this "if" is also the case for a bunch of other translation cases.
There are for example some WinAPI translations that have a "var"
parameter for pointers while they should be by-value parameters cause
they can take "Nil". It's always possible for the translator to screw up
and one needs to take care by hand that it works correctly...

Regards,
Sven




More information about the fpc-pascal mailing list