struct element orderin vs. alignment.

Kevin Martin kpmartin at watmath.UUCP
Sat Jan 5 17:58:00 AEST 1985


There seem to be people who are saying, effectively, if the language user
doesn't care about struct element alignment, he/she also deson't care
about element ordering (you care about alignment for device registers, which
are machine dependant already, right?). The problem is, that this isn't true.
 
There are many programs which believe that two structures with the same
initial set of elements have the same ordering for those elements. This
prevents the compiler from (by default) re-ordering the elements.
 
In other words, it is possible for the programmer to care about the order, but
not the alignment, of struct fields.
                               Kevin Martin, UofW Software Development Group



More information about the Comp.lang.c mailing list