I\'m getting \"error: expected \'}\'\"
where the \'^\' is pointing when I compile in the following C++ source:
typedef enum { false, true } Boolean;
false
and true
are C++ keywords, so you can't use them as enum
identifiers.
In C they are not keywords so your code will work, but if you include
then it will fail to compile because that header defines false
and true
as macros.
Note that you probably shouldn't implement a boolean type yourself. C++ already has the bool
type, and if you are using a C99 compiler, you can include stdbool.h
. This will give you a bool
type that has false
and true
values, similar to C++.