bitfields considered harmful?
Farrell Woods
ftw at masscomp.UUCP
Sun Apr 30 02:42:57 AEST 1989
In article <1473 at uwbull.uwbln.UUCP> ckl at 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 at masscomp.com
1 Technology Way uucp: {backbones}!masscomp!ftw
Westford, MA 01886 OS/2: Half an operating system
More information about the Comp.lang.c
mailing list