Un-alignment in structures

Jeff Lichtman jeff at rtech.ARPA
Fri Mar 22 12:10:55 AEST 1985


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

This isn't true on VMS.  When we converted our software from Whitesmith's
to DEC C, we found that the former aligns structures and the latter doesn't.
This caused us problems because we store structures in files, so we had to
add our own padding.

Sometimes it is a good idea to align structures on machines that don't
require it because it makes the code run faster.  Reading or writing
an aligned word takes only one memory cycle, as opposed to two for an
unaligned word.  I agree that the compiler shouldn't pad for you,
because this takes away the choice.
-- 
Jeff Lichtman at rtech (Relational Technology, Inc.)
aka Swazoo Koolak



More information about the Comp.lang.c mailing list