Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!whuxlm!akgua!mcnc!philabs!cmcl2!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.lang.c Subject: Re: Un-alignment in structures Message-ID: <4258@umcp-cs.UUCP> Date: Fri, 22-Mar-85 20:18:47 EST Article-I.D.: umcp-cs.4258 Posted: Fri Mar 22 20:18:47 1985 Date-Received: Tue, 26-Mar-85 05:32:27 EST References: <9434@brl-tgr.ARPA> Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 38 Actually, if there is a "good" solution to this, it may not be to add a modifier keyword, but instead to define a new object which is similar to a structure, but "compressed" (with access time penalties on some machines). This eliminates confusion (or so I claim). Consider the following: unaligned struct foo { short f_this; char f_that[2]; }; f (foop) unaligned struct foo *foop; { ... Is foop a pointer to an unaligned struct foo, or is it an unaligned pointer to struct foo? (The proposed "const" modifier has this problem, by the way.) dollop foo { short f_this; char f_that[2]; }; f (foop) dollop foo *foop; { ... Clearly, here "foop" is a pointer to a "dollop" of bytes. Unfortunately, this doesn't address arrays. However, I have only ever wanted unalignment once, and that in a structure. (Look at the XNS protocol headers; it requires a 4 byte object that is aligned only on a 2 byte boundary.) So to generalize from one example (always a dangerous game!), structure alignment seems more important. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland