Hello
I am currently updating a project that uses bitfields heavily
I am planning to use them as well. My question is if the following is correct, appropriate or a good idea
first the bitfield
Yeah, I know the standard recommends using unsigned ints for that but the code already use the user defined WORD.Code:
struct{
WORD somefield:1;
WORD otherfield:1;
WORD MYFIELD:2; //this is my field
}somebitfield;
Ok so I have a 2 bit field, so I guess that means it can take 4 values right?
So I define
So my question is can I safely do thisCode:enum{NOTHING=0, ONE, TWO, THREE} myenum;
or evenCode:
if(somebitfield.MYFIELD==NOTHING){
}
Any help will be greatly appreciated.Code:
switch(somebitfield.MYFIELD)
{
case NOTHING:
}
Kansai