The next C standard will add true
, false
and bool
as keywords to the language. There is already stdbool.h
which provides this type and constant. As is, the internal source uses typedef int bool
and uses macros true()
and false()
. To make all that work some magical #undef
and #define
was in use.
I have now done a global replace to get rid of the true()
and false()
macro conflict. That is purely internal and fine.
Most of the C API functions are defined as int
, but can only return 0 or 1, made available by SWI-Prolog.h
as FALSE
and TRUE
. The PL_cvt_*()
group was internally implemented with type bool
. I changed the types in SWI-Prolog.h
from int
to bool
for these and included stdbool.h
into SWI-Prolog.h
.
I consider changing all the others really boolean functions to bool
as well. I think this maintains binary compatibility as C return promotes bool
to int
(right?). Does anyone see any problems with this?
Note that I so not propose to change PL_get_bool(term_t t, int *val)
as that would break compatibility.
Opinions?