Does accessing enums through int pointers break the strict aliasing rule? Or are enums treated as ints?
Does accessing enums through int pointers break the strict aliasing rule? Or are enums treated as ints?
Incompatibilities Between ISO C and ISO C++
enums might not even be the same SIZE as an int, so no, stop thinking about whatever it is you're trying to do.
Unless you're posting on C++ just to keep things interesting...
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Ah! I wasn't aware of that.
Thanks
I believe that in C++0x you can do this:
To force it to be of integer size. Though I'm not 100% sure about this and have no time to verify atm.Code:enum SomeName : int {
Why would you want to acess an enum through an int pointer?
It's a function that is overloaded for a bunch of basic types, but not enum types, so I thought maybe I can just use the int version.
Ended up doing something completely different.