Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!husc6!cmcl2!rutgers!bellcore!tness7!tness1!sugar!ficc!peter From: peter@ficc.UUCP (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: Packed structures (was: Absolute size of 'short') Message-ID: <1258@ficc.UUCP> Date: 15 Aug 88 15:52:56 GMT References: <214@ISIDAPS5.UUCP> <9641@dartvax.Dartmouth.EDU> <62505@sun.uucp> <6104@haddock.ISC.COM> Organization: SCADA Lines: 24 In article <6104@haddock.ISC.COM>, karl@haddock.ISC.COM (Karl Heuer) writes: > 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. > Consider the following code: > packed struct { char c; int i; } x; > int *p = &x.i; ^^^^^^^^^^^^^ This should be illegal. > *p = 0; It is already illegal to take the address of one object with no legal address... a register variable. Why should it be legal to take the address of a misaligned integer? Another comment: what about: packed struct { int a:1; int b; int c:17; } argh; -- Peter da Silva, Ferranti International Controls Corporation, sugar!ficc!peter. "You made a TIME MACHINE out of a VOLKSWAGEN BEETLE?" "Well, I couldn't afford another deLorean." "But how do you ever get it up to 88 miles per hour????"