enum problem

Phil phil at spiderweb.com.au
Thu Oct 25 04:43:34 BST 2001

Hello all,

I'm trying to use an enumerated type in an effort to avoid using a large 
switch/case block, but I don't think that it's possible.

The following is a simplified example of what I'm trying to achieve.

enum Mode {a,b,c};
Mode mode;

mode = (Mode) data[4];

Data[4] is an unsigned char type and can have a value of 0,1 or 2 so mode 
will equal a, b or c at this point. So far so good.

What I want to do now is print mode so that it is either a, b or c NOT 0,1 or 
2. Something like printf("Mode = %d\n", mode).

Of course a switch statement works but Mode can have many more values that 
the 3 used in this example and so the switch block can be quite large. Is 
there a way to avoid this?
phil at spiderweb.com.au

to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«

More information about the KDevelop mailing list