Consider the following (simplified) code:
enum eTestMode
{
    TM_BASIC        = 1,    // 1 << 0
    TM_ADV_1        = 1 << 1,
    TM_ADV_2        = 1 << 2
};
...
int m_iTestMode;    // a "bit field"
bool isSet( eTestMode tsm )
{ 
    return ( (m_iTestMode & tsm) == tsm );
}
void setTestMode( eTestMode tsm )
{
    m_iTestMode |= tsm;
}
Is this reliable, safe and/or good practice? Or is there a better way of achieving what i want to do apart from using const ints instead of enum? I would really prefer enums, but code reliability is more important than readability.
 
     
     
     
     
     
    