Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC830713); site vu44.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!mhuxn!mhuxj!mhuxr!ulysses!allegra!mit-eddie!genrad!teddy!panda!talcott!harvard!seismo!mcvax!vu44!jack From: jack@vu44.UUCP (Jack Jansen) Newsgroups: net.lang.c Subject: re: the one and only objection to C Message-ID: <545@vu44.UUCP> Date: Tue, 1-Jan-85 11:44:02 EST Article-I.D.: vu44.545 Posted: Tue Jan 1 11:44:02 1985 Date-Received: Thu, 3-Jan-85 03:48:35 EST References: <1265@orca.UUCP>, <86@mit-athena.ARPA> <4841@utzoo.UUCP> Organization: The Retarded Programmers Home, VU, Amsterdam Lines: 29 Re: Alignment problems, etc. It seems that what is wanted here is something like the pascal 'packed' attribute. In a good pascal implementation (well, 'good' in my opinion, the pascal standard doesn't say what 'packed' should mean precisely) if you say 'packed' before a record, it stuffs all the fields adjacent to each other, not caring for word- boundaries, or 'intelligent alignment' so that the fields are easily extractable. This is the way 'packed' is handled in for instance the Sheffield compiler for the Prime, and all the compilers I know for the CDC Cyber machines. The problem is that all the compilers I know for byte-oriented machines like a PDP or a VAX do it the easy way, i.e. making every field an integral number of bytes, and aligning the data to the right in this field. If we had a precisely defined 'packed' feature in C, or even a formal definition of the alignment of bitfields this would be great. And, in the last case, I think we should *not* be worried about inefficiency for machines with bytes the wrong way around, etc. Just make *one* standard. Since bitfields are, as far as I know, always used for esoteric things like grabbing status bits from peripherals, etc. the programmer can easily define his bitfields so that they are reasonably efficient on *his* machine. -- Jack Jansen, {seismo|philabs|decvax}!mcvax!vu44!jack or ...!vu44!htsa!jack If *this* is my opinion, I wasn't sober at the time.