typdef'ing a enum and all its enumerators

D

Dave

I have several enums that are generated by a code generator (and I have
no control over the code generator), the problem is that the names are
pretty long

enum VeryLoooooooongEnumName
{
veryLoooooooooong1,
veryLoooooooooong2,
......
veryLoooooooooong10
};

Some old code I'm working on would use a typedef like this:

typedef VeryLoooooooongEnumName enum ShortName { short1, short2, ... };

It used to compile using gcc 2.95, but with gcc 3.2 it no longer
compiles, the error is:

"multiple types in one declaration"

So is there a good way to typedef a enum and all its enumerators?

any help appreciated, thanks in advance
 
R

Ron Natalie

Dave said:
Some old code I'm working on would use a typedef like this:

typedef VeryLoooooooongEnumName enum ShortName { short1, short2, ... };

Wrong syntax for typedef. Frankly I don't know why it ever
wroked for you.

typedef VeryLooongEnumName ShortName;

There isn't much you can do about the enumerators other than defining
a parallel enum. However they're not going to be interchangable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top