468,503 Members | 2,039 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,503 developers. It's quick & easy.

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
Jan 18 '08 #1
1 6896
pa**********@att.net wrote:
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
Jan 18 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

20 posts views Thread by Glenn Venzke | last post: by
21 posts views Thread by Andreas Huber | last post: by
31 posts views Thread by Michael C | last post: by
18 posts views Thread by Visual Systems AB \(Martin Arvidsson\) | last post: by
2 posts views Thread by Dennis | last post: by
1 post views Thread by Randy | last post: by
2 posts views Thread by Randy | last post: by
34 posts views Thread by Steven Nagy | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
reply views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.