Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!lll-winken!uunet!philmtl!ray From: ray@philmtl.philips.ca (Raymond Dunn) Newsgroups: comp.lang.c Subject: Re: "address" of a bitfield (idea 1) Message-ID: <610@philmtl.philips.ca> Date: 21 Jul 89 14:29:12 GMT References: <2840@blake.acs.washington.edu> <611@cbnewsd.ATT.COM> Reply-To: ray@philmtl.philips.ca (Raymond Dunn) Organization: Philips Electronics Ltd. - St. Laurent P.Q., Canada Lines: 22 In article <611@cbnewsd.ATT.COM> bgbg@cbnewsd.ATT.COM (brian.g.beuning) writes: >> Does anyone know of an even semi-portable way to do this? > >How about something like this? If you want to describe the >bitfields of struct x.... > [complex ad-hoc kludge omitted] Whether this works or not is irrelevant to the main issue. If you have to fight a language to this degree to make it do something for you then you either have chosen the wrong langauge for the task or you have designed your implementation (structures and/or logic) in a way inappropriate for that language. There are some things that C does superbly. The integration of the concept of structure member selectors in the langauge is not one of them. Neither is the handling of types less than 1 byte in size. -- Ray Dunn. | UUCP: ..!uunet!philmtl!ray Philips Electronics Ltd. | TEL : (514) 744-8200 Ext: 2347 600 Dr Frederik Philips Blvd | FAX : (514) 744-6455 St Laurent. Quebec. H4M 2S9 | TLX : 05-824090