why do structs have different sizes across machines?

WARlock hoswell at tramp.Colorado.EDU
Thu Mar 21 03:04:56 AEST 1991


In article <77336 at bu.edu.bu.edu> jdubb at bucsf.bu.edu (jay dubb) writes:
>
>   Can anyone explain to me why the following short program give the
>size of the structure as 38 on a Sun 3, and 40 on an Encore Multimax:
>
>main()
>{
>  struct tt
>    {
>      enum {P, PP} a;
>      char b[30];
>      int c;
>    };
>  printf("%d\n",sizeof(struct tt));
>}
>

	The difference is that the Sun is more efficient with it's data
storage.  The encore machine has a 4 byte word size, while the sun has
a smaller granularity.
	Thus, the encore adds the two (unused) bytes...


-- 
||   -=> The WARlock <=-	 |	  <<<<=- "Dial a cliche" -=>>>>      ||
||  hoswell at tramp.Colorado.EDU	 |   					     ||
|| or hoswell at yoda.hao.ucar.EDU	 |    A cynic knows the price of everything  ||
||       Think Clearly! 	 |          and the value of nothing.        ||



More information about the Comp.unix.programmer mailing list