Overzealous alignment and padding

K.LAUX rkl1 at hound.UUCP
Mon Oct 17 03:40:06 AEST 1988


	The best way is to align the structure yourself!  Sounds as if
you have structures where the first field is a 'char', so you don't
know how the compiler will align it.  So don't make the first field a
char...maybe you might have to insert a dummy 'int' field if all you
have are 'char' fields.  Alternatively, you could use a *union* of an
'int' with your structure of 'char' fields.

	What you're doing is allowing the *compiler* to decide how to
align instead of *telling* the compiler how to align...

--rkl



More information about the Comp.lang.c mailing list