Structure padding

Chad Gibbons chad at lakesys.UUCP
Fri Apr 7 04:13:22 AEST 1989


In article <440 at front.se> zap at front.se (Svante Lindahl) writes:
|Consider a struct consisting of a few character arrays, for example:
|	stuct foo {
|	    char bar[3];
|	    char baz[6];
|	    char frotz[4];
|	} fred;
|I need to know if I can safely assume that there will not be any
|padding between the arrays.

	I don't think so.  I know for sure that Intel machines do place
padding in appropriate areas in order to force alignment on even word
addresses.  I believe that Microsoft compilers have an option to
eliminate this, but that slows down the program.  I had a list of
machines that require objects to start on even word addresses, but I
can't find it....anyone? anyone?
-- 
D. Chadwick Gibbons, chad at lakesys.lakesys.com, ...!uunet!marque!lakesys!chad



More information about the Comp.lang.c mailing list