home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12437 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  1.6 KB

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