Steven Bosscher wrote:

> Of course, the semantics of "int : 0" are not defined by C99 for packed
> structs.  As far as I can tell, extend.texi doesn't discuss this case,
> so we need to come up with something that makes sense.

The semantics of zero-width bitfields (outside of packed structures) are
part of the ABI for each system.  They very somewhat from
system-to-system, but, in general, they are interpreted as alignment
directives.

> We discussed this briefly on IRC.  We have only two options AFAICT:
> 1) ignore the ": 0" field completely.  This is what we seem to do
>    since Jason's patch was commited.
> 2) when we see :0 align to the next unit, which seems to be the
>    behavior of GCC pre-3.4.
> 
> Jason suggested that it looks like they want it to mean "align the
> next field despite pragma pack".  So that is option (2), 

Yes, I think we should do option (2).  There's otherwise no point at all
in putting a zero-width bitfield into a packed structure; it seems
better to assume the user had a purpose in having the zero-width bitfield.

-- 
Mark Mitchell
CodeSourcery, LLC
[EMAIL PROTECTED]
(916) 791-8304

Reply via email to