home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!dog.ee.lbl.gov!horse.ee.lbl.gov!torek
- From: torek@horse.ee.lbl.gov (Chris Torek)
- Newsgroups: comp.lang.c
- Subject: Re: Memory alignment of struct elements
- Date: 17 Aug 1992 18:26:20 GMT
- Organization: Lawrence Berkeley Laboratory, Berkeley
- Lines: 22
- Message-ID: <25533@dog.ee.lbl.gov>
- References: <1992Aug12.133132.10723@Princeton.EDU> <BsxCtz.598@unx.sas.com> <adam.714060134@mcrware>
- Reply-To: torek@horse.ee.lbl.gov (Chris Torek)
- NNTP-Posting-Host: 128.3.112.15
-
- In article <adam.714060134@mcrware> adam@microware.com (Adam Goldberg) writes:
- >That's all well and good, but what if, say, you are coding an implementation
- >of LIM EMS 4.0, which takes as a parameter a structure which, in assembler,
- >looks like [radically machine-dependent example omitted].
-
- >Is there any standard way to FORCE the C Struct to be identical to the
- >Asm struct?
-
- Well, obviously if you are talking about coding for compatibility with
- a specific assembler interface, you are throwing portability off the
- top of the Sears Tower (never to be seen again), so you buy the C
- compiler that comes with the appropriate compilation directives---as
- compile-time options or `__packed' keywords or #pragma's or whatever
- ---and use those.
-
- To paraphrase a famous statement, ``If you want assembly language, you
- know where to find it.'' It is no good asking for C to be portably
- nonportable. Some machines---like the ones I use---are physically
- incapable of accessing unaligned data. (It causes a machine fault.)
- --
- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
- Berkeley, CA Domain: torek@ee.lbl.gov
-