B
Ben Hinkle
I'm curious, what was the rationale for making a builtin type _Bool but then
having
#define true 1
#define false 0
in stdbool.h? That seems very odd that true and false don't have type _Bool.
In particular I'm poking around with some language extensions to C and one
of the most obvious extensions is overloading. Since "true" doesn't have
type _Bool it makes overloading behavior with _Bool very odd. You'd think
that at least it could be
#define true ((bool)1)
I notice in the C99 spec it says the true and false defines "are suitable
for use in #if preprocessor directives". Was it anticipated that true and
false would be used primarily for #if directives? One would imagine that a
more important property would be something like sizeof(bool) ==
sizeof(true).
thanks,
-Ben
having
#define true 1
#define false 0
in stdbool.h? That seems very odd that true and false don't have type _Bool.
In particular I'm poking around with some language extensions to C and one
of the most obvious extensions is overloading. Since "true" doesn't have
type _Bool it makes overloading behavior with _Bool very odd. You'd think
that at least it could be
#define true ((bool)1)
I notice in the C99 spec it says the true and false defines "are suitable
for use in #if preprocessor directives". Was it anticipated that true and
false would be used primarily for #if directives? One would imagine that a
more important property would be something like sizeof(bool) ==
sizeof(true).
thanks,
-Ben