August Karlstrom said:
OK, you're right, sorry. The existence of the header file has made me
think it's not a native type. So _Bool is just an integer type that
can hold two values: 0 or 1, and it's called _Bool just to minimize
the risk of breaking existing programs, right?
Right. It can almost certainly hold values other than 0 or 1, but
since conversion from any integer type to _Bool always yields a result
of 0 or 1, it's difficult to store any other value in a _Bool object.
A more extreme
defensive approach would be to call it __BoOl or something ;-)
That's not necessary, since _Bool is already in the reserved namespace
(as are _Complex and _Imaginary). Any C90 program using _Bool is in
trouble anyway.
...and that's why expressions such as `a < b < c' has the strange
(unexpected) semantics.
The semantics aren't strange at all *if* you look at them as being
built up from the semantics of the individual operators. "a + b + c"
is equivalent to "(a + b) + c". "a - b - c" is equivalent to
"(a - b) - c". The fact that the same rule applies to "a < b < c"
looks strange only because of the rather odd shorthand used in
mathematics. Programming languages tend to treat true/false values as
ordinary values; mathematics often treats them specially. The
approach used in programming languages is actually more uniform.
<OT>
Even in languages in which the native boolean type is non-numeric,
"a < b < c" tends not to mean what it means in mathematics. For
example, in Pascal the type Boolean is a special enumeration type (not
numeric) with values False and True and the relationship False < True.
The expression "a < b < c" is valid only if c is of type Boolean; the
result is equivalent to "(a < b) < c", and is either False or True.
</OT>