Marvin Humphrey wrote on 12/10/09 7:30 PM:

Those will allow us to eliminate all the chy int types except for bool_t,
which we'll replace with "bool".  For "bool", we could use a three-part probe:

    If the C99 header stdbool.h is available, we pound-include it in
    charmony.h.

    Else if the macro "__cplusplus" is defined, then we just use C++'s
    built-in bool type.

    Else we typedef "bool" to int and conditionally define "true" and "false",
    just like we're doing now for chy_bool_t.

I'm not sure about that third branch, though, because it could potentially
conflict with somebody else typedef-ing bool to "char".  "chy_bool_t" was
safe to muck with, but "bool" is not.

So, probably the best move is to just omit the third branch, making either
stdbool.h or C++ a prerequisite for Lucy.


I will tackle this in a separate patch. I agree about avoiding the 3rd branch. In libswish3 I define a 'boolean' (spelled out long to avoid conflict) as a char. I expect others out there have done similar.

--
Peter Karman  .  http://peknet.com/  .  [email protected]

Reply via email to