(The question is related to my previous questions here , here , here , and here ).
I support a very old application, ported a few years ago from DOS to Windows, but many old C conventions are still ported.
The only specific convention is the macro setBit and clrBit:
#ifndef setBit
#define setBit(word, mask) word |= mask
#endif
#ifndef clrBit
#define clrBit(word, mask) word &= ~mask
#endif
I found that I can declare a variable as an enumeration type and set my variable equal to one of the enumerated values listed.
enum SystemStatus
{
SYSTEM_ONLINE = BIT0,
SYSTEM_STATUS2 = BIT1,
SYSTEM_STATUS3 = BIT2,
SYSTEM_STATUS4 = BIT3
};
C BIT0 = 0x00000001, BIT1 = 0x00000002etc.
SystemStatus systemStatus;
systemStatus = SYSTEM_ONLINE
In your opinion, uses the setBit and clrBit macros more like C or C ++ - and would it be better to just declare the variables as an enumerated type and get rid of all the old setBit / clrBit stuff?
user195488