Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ll-xn!mit-eddie!genrad!panda!teddy!jpn From: jpn@teddy.UUCP (John P. Nelson) Newsgroups: comp.unix.wizards,comp.lang.c Subject: Re: bitfields Message-ID: <3523@teddy.UUCP> Date: Mon, 1-Dec-86 07:57:44 EST Article-I.D.: teddy.3523 Posted: Mon Dec 1 07:57:44 1986 Date-Received: Mon, 1-Dec-86 19:57:01 EST References: <844@sphinx.UChicago.UUCP> Reply-To: jpn@teddy.UUCP (John P. Nelson) Followup-To: comp.lang.c Distribution: na Organization: GenRad, Inc., Concord, Mass. Lines: 21 Xref: mnetor comp.unix.wizards:208 comp.lang.c:191 >Ok, folks, here is the burining question of the hour: how are bit fields in >C dealt with? As I read K&R arrays of bit fields are allowed, HOWEVER, in >the Microsoft C compiler Version 4.0, they explicitly state that they are not >allowed. If K&R is Kernighan and Ritchie, I suggest you reread it. Arrays of bitfields are EXPLICITLY disallowed (See the last paragraph in section 6.7) - but in any case, an array of bitfields is impossible, not just difficult - Remember that a reference to an array (not just an element of it) evaluates to an ADDRESS - However, taking the address of a bit field is also explicitly disallowed. Here is part of the relavent paragraph from K&R Other restritrictions (of bit fields) to bear in mind: ... They are not arrays; they do not have addresses, so the & operator cannot be applied to them. and again, in appendix A where structures are formally defined (section 8.5): ... In all implementations, there are no arrays of fields, and the address-of operator '&' may not be applied to them, so that there are no pointers to fields.