I recently was code generating some bitfields and I was using const expressions to fill out the bitfield. (C++ 03)
I'm wondering a few things. 1. Is this a good idea. 2. Is this guranteed by GCC. 3. Is this going to work (it compiles, waiting to test).
const uint16_t bitSize = 5;
struct MyStruct
{
uint32_t myfield : bitSize;
};