Connecting Tech Pros Worldwide Help | Site Map

Is this use of enum ok?

  #1  
Old January 18th, 2008, 06:25 AM
pauldepstein@att.net
Guest
 
Posts: n/a
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, 06:55 AM
Jensen Somers
Guest
 
Posts: n/a

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
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use of a template class object? teel answers 2 October 3rd, 2007 05:05 AM
is this ok with arrays rodchar answers 3 November 21st, 2005 06:54 PM
Global access of Enum P K answers 2 November 19th, 2005 11:25 PM
C++ Compiler with a -Wwarn-use-of-strcpy or similar option?? Paul Sheer answers 7 July 22nd, 2005 08:00 PM