O
oiccicny
Is there a way to do the following code so that
day_data and other_data_1 occupy the same byte in
memory? Using the debugger, the addresses I'm getting are:
12ff5c - myVar.day_data
12ff60 - myVar.other_data_1
I'm using Microsoft Visual C++. sizeof(unsigned short) returns 2.
Thanks!
(e-mail address removed)
enum DAY {SUN,MON,TUE,WED,THUR,FRI,SAT};
class myClass
{
public:
DAY day_data : 3;
unsigned short other_data_1 : 5;
unsigned short other_data_2 : 8;
};
void main(void)
{
myClass myVar;
};
day_data and other_data_1 occupy the same byte in
memory? Using the debugger, the addresses I'm getting are:
12ff5c - myVar.day_data
12ff60 - myVar.other_data_1
I'm using Microsoft Visual C++. sizeof(unsigned short) returns 2.
Thanks!
(e-mail address removed)
enum DAY {SUN,MON,TUE,WED,THUR,FRI,SAT};
class myClass
{
public:
DAY day_data : 3;
unsigned short other_data_1 : 5;
unsigned short other_data_2 : 8;
};
void main(void)
{
myClass myVar;
};