Packed structures (was: Absolute size of 'short')

William E. Davidsen Jr davidsen at steinmetz.ge.com
Wed Aug 17 03:07:42 AEST 1988


In article <1258 at ficc.UUCP> peter at ficc.UUCP (Peter da Silva) writes:
| In article <6104 at haddock.ISC.COM>, karl at haddock.ISC.COM (Karl Heuer) writes:
| > In article ... davidsen at 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.

| 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?

  Thank you for a good solution to the problem to pointers. Obviously if
this was added it would have to be illegal on all machines, not just
those which couldn't hack the addressing.

| Another comment: what about:
| 
| 	packed struct { int a:1; int b; int c:17; } argh;

  Yes, I was careful to say byte alligned for this reason, but I may
not have discussed the rationale. Bit alligned is so rarely useful that
I can see no reason for adding it to the language. Byte alligned is
nice for passing data between machines, such as computers and control
equipment.

-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list