Hey, I'm just wondering if overflowing is defined and portable when used like so:
Is this standard and defined for unsigned types?Code:struct myData { unsigned short s : 2; //limit range to two bits, i.e., 0 to 3 in base 10 }test = {0}; ++ test.s; //1 ++ test.s; //2 ++ test.s; //3 ++ test.s; //0 ++ test.s; //1 ++ test.s; //2 //etc...
What about signed types?
Can my program rely on this behavior and still remain architecture-independent?
Thanks in advance!




Reply With Quote