E
Eric Beyeler
I ran into an interesting characteristic of enums... why is comparison
between different types allowed? assignment is not allowed ( which I
would expect )
enum TESTA
{
TestA1=4,
TestA2=5,
};
enum TESTB
{
TestB1=7,
TestB2=8,
};
int main()
{
TESTA a;
a = TestA2;
TESTB b;
b = TestB2;
//a = TestB2; // not allowed
if (a == b) // why is this legal?
{
}
if ( a == TestB2 ) // why is this legal?
{
}
}
Eric B
between different types allowed? assignment is not allowed ( which I
would expect )
enum TESTA
{
TestA1=4,
TestA2=5,
};
enum TESTB
{
TestB1=7,
TestB2=8,
};
int main()
{
TESTA a;
a = TestA2;
TESTB b;
b = TestB2;
//a = TestB2; // not allowed
if (a == b) // why is this legal?
{
}
if ( a == TestB2 ) // why is this legal?
{
}
}
Eric B