Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!elf115!rec From: rec@elf115.uu.net (Roger Critchlow) Newsgroups: comp.lang.c Subject: Re: "address" of a bitfield Summary: Sorry, no solution Message-ID: <158@elf115.uu.net> Date: 17 Jul 89 16:04:36 GMT References: <2840@blake.acs.washington.edu> Organization: ELF, Sea Cliff, NY Lines: 27 In article <2840@blake.acs.washington.edu>, wiml@blake.acs.washington.edu (William Lewis) writes: > > [reasonable reasons for wanting the address of a bitfield] > > Does anyone know of an even semi-portable way to do this? Or, if > there is no portable way, a way that works with Mark Williams C on > a MSDOS machine? There isn't currently any way to do this with the Mark Williams compiler, and there is no way to do this defined by the dpANS. But, I note that the result of the dpANS offsetof() macro is undefined when applied to a bitfield member, and if a compiler treated this macro with special care it might be possible to provide the necessary infor- mation for those who need it. One possibility would be for offsetof(type, bit-field-member) to generate a triple of constants: bit_offset_constant, bit_width_constant, byte_offset_constant which could be plugged into a user defined function call argument list to a bit field pointer constructor. Does anyone see any problems with this as an extension to dpANS? -- rec@elf115.uu.net --