just like the subject says...

In C++, unlike C, you do not need to use typedef on
structs or enums.

/////
enum example { enumA = 1, enumB = 2 }; // No typedef given

example anExample = enumA;  // This still works
/////

Your problems with the boolean type you are defining
most likely stem from the fact that 'true' and 'false'
are keywords in the new C++ standard.  Your compiler
almost certainly supports the new 'bool' type.

I suggest using the built in bool type.

Bryan Scaringe


> 
> On Wed, 10 Jun 1998, holotko wrote:
> 
> > Are straightforward user defined enumerated data types permissible in
> > gcc/g++.
> > For example if I wished to declare:
> > 
> >      enum boolean {true, false};
> > 
> > so that I can use the defined data type "boolean", as a return type for
> > overloaded operator function of a class. Upon trying to accomplish this
> > the compiler generates a series of obscure errors, parse errors, etc.
> 
>       typedef enum {false, true} boolean;
> 
> Or perhaps to make it clearer for you:
>       enum boolean_enum {false, true};
>       typedef enum boolean_enum boolean;
> 
> I'm pretty sure C++ has a builtin bool or boolean type, though.
> -- Elliot
> When I die, I want to die peacefully in my sleep like my grandfather...
>       ...not yelling and screaming like the people in the back of the
>          plane he was flying.
> 
> 
 

Reply via email to