By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,443 Members | 1,409 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,443 IT Pros & Developers. It's quick & easy.

typdef'ing a enum and all its enumerators

P: n/a
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

Nov 9 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Dave wrote:
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.
Nov 9 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.