Path: utzoo!utgpu!water!watmath!clyde!rutgers!psuvax1!gondor.cs.psu.edu!schwartz From: schwartz@gondor.cs.psu.edu (Scott E. Schwartz) Newsgroups: comp.arch Subject: Re: RISC data alignment Summary: you had better use XDR or something similar Message-ID: <3246@psuvax1.psu.edu> Date: 23 Jan 88 20:56:22 GMT References: <2635@calmasd.GE.COM> Sender: netnews@psuvax1.psu.edu Reply-To: schwartz@gondor.cs.psu.edu (Scott E. Schwartz) Organization: Penn State University Lines: 29 In article <2635@calmasd.GE.COM> gjo@calmasd.UUCP (Glenn Olander) writes: >machines? In particular, I believe that many RISC machines require data >to be aligned on a natural boundary, e.g. longwords must be referenced >on a 4-byte boundary. This is true of sparc. >If this is true, then it would seem to also be true that a C structure >could have different lengths, depending on whether it was compiled >on a RISC or non-RISC machine. Further, it would seem that >if that C structure were written out to a file, it could only be read >properly by a machine of the same type as that which wrote it. This is exactly correct. >Does such incompatibilty truly exist? If I create a file on a Sun/4 >will I be able to read it on a Sun/3? From "Porting Software to SPARC", Sun part no. 800-1596-10, Nov '87, p4: Because of the three considerations above, members of a given structure may have different offsets on SPARC machines than on the MC680x0, and the structure as a whole may have a different size. Even though data representations identical on the MC680x0 and the SPARC, binary files where raw structures have been written out may not be portable between processors. -- Scott Schwartz schwartz@gondor.cs.psu.edu