On Sat, 26 Aug 2017, Sven Barth wrote:
Sorry for being naive. Why not simply use a boolean ?
I thought all this BOOL mess was just meant to be able to interface with C
libs slightly easier.
Instead of
If (SomeCfunction()<>0) then
DoSomethingStupid;
it allows you to write - in appropriate cases - the following:
if (SomeCfunction()) then
DoSomethingStupid;
I don't think we should promote BOOL and friends too much. They are a
convenience (which IMHO should not have been introduced in the first place).
Promoting them to first-class Pascal citizens is IMHO a bad idea.
Did you read the article that had been linked? That's an important point
that is raised in there.
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.
Michael.
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal