Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!fluke!ssc-vax!lee From: lee@ssc-vax.UUCP (Lee Carver) Newsgroups: comp.lang.c Subject: Re: Packed structures (was: Absolute size of 'short') Summary: why not "packed" on byte/short/int/long/float/double/struct boundary? Message-ID: <1128@ssc-bee.ssc-vax.UUCP> Date: 17 Aug 88 15:55:03 GMT References: <214@ISIDAPS5.UUCP> <9641@dartvax.Dartmouth.EDU> <62505@sun.uucp> <11868@steinmetz.ge.com> Organization: Boeing Aerospace Corp., Seattle WA Lines: 30 In article ... davidsen@crdos1.UUCP (bill davidsen) writes: > I would really like to see a "packed struct," also. This would be a > struct packed on byte boundaries without fill, no matter *how bad* the > code was to use them. In article <1258@ficc.UUCP> peter@ficc.UUCP (Peter da Silva) writes: > ... how about .. > packed struct { int a:1; int b; int c:17; } argh; Why should packing be constrained to byte boundarys. Why not any 'type' boundary? Sure, some elements might not have addresses, but the code is probably machine/application dependent any. Invariably packed structures are. So how about packed [ type-specifier ] [ structure-specifier ] The elements of the structure-specifier are aligned to type-specifier boundaries. Maybe default to byte if an empty type- specifier is used? Allow the type specifer to be anything, even other structures. Then, some proposals might be represented as: packed short struct { char a; long b; char c; } blix; and for wierdness packed structure blix struct { float b; char *d;} blax;