Connecting Tech Pros Worldwide Help | Site Map

Is this use of enum ok?

 
LinkBack Thread Tools Search this Thread
  #1  
Old January 18th, 2008, 05:25 AM
pauldepstein@att.net
Guest
 
Posts: n/a
Default Is this use of enum ok?

Is there any problem with this code?

class A
{
public:
enum B {C=-1, D = 1, E=2, F = 3, G = 4};


//
//
};

I ask because I've never seen a negative enum value before.

Thanks,

Paul Epstein

  #2  
Old January 18th, 2008, 05:55 AM
Jensen Somers
Guest
 
Posts: n/a
Default Re: Is this use of enum ok?

pauldepstein@att.net wrote:
Quote:
Is there any problem with this code?
>
class A
{
public:
enum B {C=-1, D = 1, E=2, F = 3, G = 4};
>
>
//
//
};
>
I ask because I've never seen a negative enum value before.
>
Thanks,
>
Paul Epstein
In C++ enumerator values can be negative. I think the only problem will
occur if you try to use bitwise operations on them, where you can loose
the negative sign.

- Jensen
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.