Newsgroups: comp.unix.programmer
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!boulder!tramp.Colorado.EDU!hoswell
From: hoswell@tramp.Colorado.EDU (WARlock)
Subject: Re: why do structs have different sizes across machines?
Message-ID: <1991Mar20.170456.15026@colorado.edu>
Sender: news@colorado.edu (The Daily Planet)
Nntp-Posting-Host: tramp.colorado.edu
Organization: University of Colorado, Boulder
References: <77336@bu.edu.bu.edu>
Distribution: usa
Date: Wed, 20 Mar 1991 17:04:56 GMT

In article <77336@bu.edu.bu.edu> jdubb@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@tramp.Colorado.EDU	 |   					     ||
|| or hoswell@yoda.hao.ucar.EDU	 |    A cynic knows the price of everything  ||
||       Think Clearly! 	 |          and the value of nothing.        ||
