O
Owen Ransen
Guest
VS2015 does not check for compatibility of enums. I'm pretty sure it used to. For example I used to get a warning when I compared enums of different types, here for example:
typedef enum {
a1,a2,a3
} EnumAA ;
typedef enum {
b1,b2,b3
} EnumBB ;
bool SillyCheck() const
{
EnumAA varA = a1;
EnumBB varB = b2;
if (varA == varB) { // WHY NO WARNING HERE???
// Do this
return true;
} else {
// do that
return false;
}
return true ;
}
The great thing about enums used to be that you could not mix them... may as well return to defines!
What have I missed, my Warning Level is 4...
http://www.ransen.com Cad and Graphics software
Continue reading...
typedef enum {
a1,a2,a3
} EnumAA ;
typedef enum {
b1,b2,b3
} EnumBB ;
bool SillyCheck() const
{
EnumAA varA = a1;
EnumBB varB = b2;
if (varA == varB) { // WHY NO WARNING HERE???
// Do this
return true;
} else {
// do that
return false;
}
return true ;
}
The great thing about enums used to be that you could not mix them... may as well return to defines!
What have I missed, my Warning Level is 4...
http://www.ransen.com Cad and Graphics software
Continue reading...