bit fields

1
2
3
4
5
struct bitField
{
    unsigned char: 3
    unsigned: 0
    unsigned char: 5


What's the purpose of the unnamed bitfield? What does the memory structure look like?
They are usually present to fill the missing bits to a two-power
I believe that unsigned: 0 won't work
1)
So here, the first three bits are reserved for unsigned char, fourth bit is padded and 5th through 9th bit (next 5 bits) are reserved for unsigned char. Is this correct?

2)
1
2
3
4
5
6
struct bitField
{
    unsigned char: 5
    unsigned char: 0
    unsigned char: 10
}

first 5 bits are reserved
next 3 bits are padded
next 10 bits are reserved

Is this correct?

Last edited on
Does anyone know about this?
Topic archived. No new replies allowed.