Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   typdef'ing a enum and all its enumerators (http://www.velocityreviews.com/forums/t449654-typdefing-a-enum-and-all-its-enumerators.html)

Dave 11-09-2005 02:52 AM

typdef'ing a enum and all its enumerators
 
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


Ron Natalie 11-09-2005 12:41 PM

Re: typdef'ing a enum and all its enumerators
 
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.


All times are GMT. The time now is 04:29 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.