Question: I see in some C++ code things like:

```
// Header
struct SomeStruct {
    uint32_t nibble1:4, bitField1:1, bitField2:1, bitField3:1, bitField4:1,
             padding:11, field5Bits:5, byteField:8;
};

```

What is this called? I typically like to google before asking here, but I have no idea what to even type in. I'm hoping to understand this when it comes to endianness - is bit order something to consider or just byte order? Also, what is the type of each field - bitFieldX should be a bool, while field5Bits should be a uint8\_t. At least that's what I would think.

Thanks.

Answer: 
1. They are called bitfields ([MSVC](http://msdn.microsoft.com/en-us/library/ewwyfdbe.aspx)) ([GCC](http://gcc.gnu.org/onlinedocs/gccint/Bit_002dFields.html))
2. Endianess usually refers to the order of bytes. However bit order can be important, see the above links.
3. They behave as an unsigned int (uint32\_t) in your case.
In general, the term for selecting several bits out of a larger binary integer representation is *masking*.