I was wondering weather or not you could define a bitfield for a bit or a byte then rename int as a byte. Like this
union {
int bit : 1;
int byte : 8;
};
typedef int bit;
typedef itn byte;
I tried it out like that but it didn't work. Is there a way to do this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Union members have separate name space, so your typedef's only declare new typedef name bit with type int and byte with type itn what are not bitfields and not union members.
tkorrovi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was wondering weather or not you could define a bitfield for a bit or a byte then rename int as a byte. Like this
union {
int bit : 1;
int byte : 8;
};
typedef int bit;
typedef itn byte;
I tried it out like that but it didn't work. Is there a way to do this?
Union members have separate name space, so your typedef's only declare new typedef name bit with type int and byte with type itn what are not bitfields and not union members.
tkorrovi