[cfe-dev] patch: boolean bitfield init

Daniel Dunbar daniel at zuster.org
Thu Jul 17 18:36:13 PDT 2008


g++ 4.01 on OSX, the size of the struct is 2, and x.x is 1 (also for 
an initializer where the low bit is 0) and remains 1 after ++x.x.


----- Original Message ----
From: Eli Friedman <eli.friedman at gmail.com>
To: Daniel Dunbar <daniel at zuster.org>
Cc: cfe-dev at cs.uiuc.edu
Sent: Thursday, July 17, 2008 6:28:51 PM
Subject: Re: [cfe-dev] patch: boolean bitfield init

On Thu, Jul 17, 2008 at 6:24 PM, Daniel Dunbar <daniel at zuster.org> wrote:
> 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




More information about the cfe-dev mailing list