Comparison of data types

S

sreeni

I have a warning 'comparison between enum and const enum'.

I tried using static_cast<>.The warning is resolved.but is it really
safe at runtime.
 
I

Ian Collins

sreeni said:
I have a warning 'comparison between enum and const enum'.

I tried using static_cast<>.The warning is resolved.but is it really
safe at runtime.
Show the code.
 
E

Erik Wikström

Seconded, but I would like to add that you should probably use
const_cast to cast the non-const enum to const before comparing instead
of using static_cast.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,516
Latest member
ChrisHibbs

Latest Threads

Top