Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ulowell!masscomp!ftw From: ftw@masscomp.UUCP (Farrell Woods) Newsgroups: comp.lang.c Subject: Re: bitfields considered harmful? Message-ID: <786@masscomp.UUCP> Date: 29 Apr 89 16:42:57 GMT References: <1473@uwbull.uwbln.UUCP> Reply-To: ftw@quasar.UUCP (Farrell Woods) Distribution: comp Organization: MASSCOMP - Westford, Ma Lines: 25 Approved: news In article <1473@uwbull.uwbln.UUCP> ckl@uwbln.UUCP (Christoph Kuenkel) writes: >Now, are bitfields generally considered harmfull? If they're harmful, then why would we keep them around or use them? It's tempting to use them for things like mapping hardware device registers to the bit level, in some kind of device driver. This is non-portable if I'm not mistaken, but not explicitly harmful. >Are there other good reasons to avoid them? If they're not implemented correctly in your compiler... >what does ANSI C say about it? The pANS will tell you what behavior to expect from bitfields, and it will tell you about some gray areas (implementation-defined) in their definition and use. -- Farrell T. Woods Voice: (508) 392-2471 Concurrent Computer Corporation Domain: ftw@masscomp.com 1 Technology Way uucp: {backbones}!masscomp!ftw Westford, MA 01886 OS/2: Half an operating system