I assume something like this cast is legal (where foo is a pointer to void) :
struct on_off {
unsigned light : 1;
unsigned toaster : 1;
int count; /* 4 bytes */
unsigned ac : 4;
unsigned : 4;
unsigned clock : 1;
unsigned : 0;
unsigned flag : 1;
};
((on_off) foo).count = 3;
But I'm wondering if the struct is not defined whether something like this is legal :
((struct {
unsigned light : 1;
unsigned toaster : 1;
int count; /* 4 bytes */
unsigned ac : 4;
unsigned : 4;
unsigned clock : 1;
unsigned : 0;
unsigned flag : 1;
}) foo).count = 3;
... or something along these lines.
Thanks!