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

el es el.es.cr at gmail.com
Wed Aug 30 14:13:10 CEST 2017


On 28/08/17 03:12, Paulo Costa wrote:
> On 27-Aug-17 23:47, Dmitry Boyarintsev wrote:
>> 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)
> 
> Of course, that is because, in C, any value that is not zero, is true.
> 
> So you can not compare with 1 or -1 or any other value to test if it is true...
> 
> Paulo Costa

Even more 'proliferated' may be usage like

- function returns = 0 on success 

- function returns > 0 for a success-with-a-hint or soft-failure (allowing for retry)

- returns negative error code on hard-failure (not-allowing for retry)

-L.




More information about the fpc-pascal mailing list