stdbool.h doesn't properly define `true'
Martin Buchholz
martin@xemacs.org
Sun Dec 5 01:54:00 GMT 1999
The C99 standard says (draft)
----------------------------------------------------
[#3] The macros are
true
which expands to the decimal constant 1,
....
The macros are suitable for use in #if preprocessing directives.
----------------------------------------------------
This suggests that the following program fragment should not give an error:
#if true != 1
#error Huh?
#endif
but gcc-2.95.2 does.
Instead of the Oh-So-Clever
typedef enum { false=0, true=1 } bool;
#define false false
#define true true
Why not just use what the Draft standard suggests?
typedef enum { false=0, true=1 } bool;
#define false 0
#define true 1
More information about the Gcc-bugs
mailing list