Un-alignment in structures

Ron Natalie <ron> ron at brl-tgr.ARPA
Sat Mar 16 05:37:29 AEST 1985


> 
> 	the reason for the padding, which admittedly does not hold for
> some machines, is that many machines, notably the pdp-11, can not
> handle words generated at an odd address.  if the compiler was allowed
> to generate incorrectly aligned data then the compiler would rapidly
> acquire, and rightfully so, a reputation for uselessness; the code
> produced would generate odd instruction traps at the most inconvenient
> locations.
> 
Understandable, but with loss of effieciency you ought to be able
to at least assign in and out of "unaligned" data.  I know that taking
the address of something that is aligned incompatibly with the machine
(like odd ints on pdp-11s) and thn passing it as a pointer is going
to cause problems.

What really galls me is that the VAX, which has virtually no alignment
restrictions, insists on padding out structures where the exact same
declaration on the PDP-11 doesn't.

-Ron



More information about the Comp.lang.c mailing list