I'm not sure if this could be compile related, but the compiler I'm using is IAR 7.10.3.
I have a struct like follows:
struct A {
struct {
uint8_t x:1;
uint8_t y:2;
uint8_t z:5;
} b;
};
And initializes it like:
struct A a = {
.b = 0xFF,
};
Now when I look at the struct in memory, only the x bit will be set to '1', the rest will be zero.
Is this how it should behave according to the C standard?