home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:12685 comp.sys.sun.misc:3859
- Path: sparky!uunet!gatech!bloom-beacon!eru.mt.luth.se!lunic!sunic!seunet!comm!news.nexus.comm.se!news!Thomas.Tornblom
- From: Thomas.Tornblom@nexus.comm.se (Thomas Tornblom)
- Newsgroups: comp.lang.c,comp.sys.sun.misc
- Subject: Re: How to use the same file of structs on PC and Sun?
- Message-ID: <THOMAS.TORNBLOM.92Aug24013032@beck.nexus.comm.se>
- Date: 24 Aug 92 00:30:32 GMT
- References: <71527@apple.Apple.COM>
- Sender: news@nexus.comm.se
- Organization: Communicator Nexus AB
- Lines: 38
- In-Reply-To: may@Apple.COM's message of 23 Aug 92 02: 07:49 GMT
-
- In article <71527@apple.Apple.COM> may@Apple.COM (Patrick May) writes:
-
- Hi,
-
- I'm porting an application from an MS-DOS environment to the Sun
- (SunOS 4.1.1). The app makes heavy use of files opened in binary mode
- to store various structs. When I tried to use these same files on the
- Sun I found that the Sun compiler came up with a different size for
- these structs than did the MS-DOS compiler (uSoft). I'd half expected
- something like this, and had intended to do a one-time conversion of
- the affected files.
-
- Unfortunately, these files may be accessed by the both the Sun
- and MS-DOS versions of the application over, for example, PC/NFS.
- Is there a way to tell the Sun compiler not to do any alignment (if
- in fact that's what's happening) or, alternatively, to tell the
- Microsoft compiler to act the same as the Sun compiler?
-
- Thanks,
-
- Patrick May
- may@apple.com (posting from, but not working or speaking for, Apple)
- ------------------------------------------------------------------------
- "A contract programmer is always intense."
-
- You are facing more severe problems than you think. Not only is the
- alignment different, the byte order is also different. The intel goo
- is little endian which means that the least significant bytes of a
- word are at lower addresses. All suns, except the sun386i, are big
- endian where the most significant bytes of a word are stored at low
- addresses.
-
- Thomas
- --
- Real life: Thomas Tornblom Email: Thomas.Tornblom@nexus.comm.se
- Snail mail: Communicator Nexus AB Phone: +46 18 171814
- Box 857 Fax: +46 18 696516
- S - 751 08 Uppsala, Sweden
-