Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!tcdcs!dce.ie!em From: em@dce.ie (Eamonn McManus) Newsgroups: comp.std.c Subject: Re: Bitfields in unions Message-ID: Date: 22 Apr 91 18:47:15 GMT References: <680@taumet.com> <72969@brunix.UUCP> Organization: Datacode Communications Ltd, Dublin, Ireland Lines: 31 gvr@cs.brown.edu (George V. Reilly) writes: >+ The ANSI C standard says explicitly that a union may contain a bitfield. >Well, that's another thing that Harbison & Steele III have got wrong, >then. As I mentioned in my original message, K&R2 also seems to imply obliquely that unions may not contain bitfields. Section A8.3: ... A struct-declaration-list is a sequence of declarations for the members of the structure or union: ... Usually, a struct-declarator is just a declarator for a member of a structure or union. A structure member may also consist of a specified numbers of bits. Such a member is also called a /bit-field/, or merely /field/; its length is set off from the declarator for the field name by a colon. struct-declarator: declarator declarator[opt] : constant-expression Although the grammar allows union bitfields, the text by saying `A *structure* member may also...' seems to be excluding unions. It should say `A structure or union member...' or just `Such a member...'. , Eamonn