patch: boolean bitfield init

I'm fairly sure that gcc is treating _Bool as an unsigned char as widths
1-8 work and allow the full range of values, but I haven't checked the
gcc implementation yet. For C++ g++ appears to treat it as padding as
you describe.

Which version are you using? And how does it deal with the following code?
struct {bool x : 9;} x = {255}; int c() {return x.x==1;}

-Eli

I'm fairly sure that gcc is treating _Bool as an unsigned char as widths
1-8 work and allow the full range of values, but I haven't checked the
gcc implementation yet. For C++ g++ appears to treat it as padding as
you describe.

I think the compiler is always required to keep the bool containing 0 or 1. The bitfield width allows the user to pack them more densely. On Darwin/ppc32 for example, sizeof(_Bool) is 4, which makes bitfielding them a very useful thing :slight_smile:

-Chris