home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20296 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.2 KB

  1. Xref: sparky comp.lang.c:20296 comp.lang.fortran:5220
  2. Newsgroups: comp.lang.c,comp.lang.fortran
  3. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!emory!sol.ctr.columbia.edu!still3.chem.columbia.edu!shenkin
  4. From: shenkin@still3.chem.columbia.edu (Peter Shenkin)
  5. Subject: Re: calling a Fortran subroutine from a C program
  6. References: <ig25.728061129@fg30> <1993Jan26.160622.24483@sol.ctr.columbia.edu> <1k49dbINNeij@gap.caltech.edu>
  7. Sender: nobody@ctr.columbia.edu
  8. Organization: Dept. of Chem, Columbia U, New York
  9. Date: Wed, 27 Jan 1993 17:08:39 GMT
  10. Message-ID: <1993Jan27.170839.4106@sol.ctr.columbia.edu>
  11. Distribution: na
  12. X-Posted-From: still3.chem.columbia.edu
  13. NNTP-Posting-Host: sol.ctr.columbia.edu
  14. Lines: 38
  15.  
  16. In article <1k49dbINNeij@gap.caltech.edu> shepard@sampson.ccsf.caltech.edu (Ron Shepard) writes:
  17. >In article <1993Jan26.160622.24483@sol.ctr.columbia.edu> shenkin@still3.chem.columbia.edu (Peter Shenkin) writes:
  18. >>In article <ig25.728061129@fg30> ig25@fg30.rz.uni-karlsruhe.de (Thomas Koenig) writes:
  19. >>>An implementation might very well choose to start every character
  20. >>>variable on a word boundary, for speed reasons.
  21. >>>
  22. >>>      CHARACTER*1 STRING(100)
  23. >>>
  24. >>>would then appear to C to be an array of ints, instead of chars.
  25. >>
  26. >>I think Cray in fact does this, while placing CHARACTER*1 scalars
  27. >>on byte boundaries.
  28. >>
  29. >>    -P.
  30. >
  31. >Fortran requires some storage relations to hold between character
  32. >scalars and arrays....  In particular
  33. >
  34. >    character*1   array(100)
  35. >    character*100 scalar
  36. >    equivalence  (array, scalar)
  37. >
  38. >requires that array(i) and scalar(i:i) refer to the same character
  39. >storage location....
  40. >
  41. >The "array of ints" comment above is incorrect because of this
  42. >storage location requirement....
  43.  
  44. If you read the above excerpts more carefully, you will see that I was
  45. referring only to CHARACTER *1 scalars vs. CHARACTER *1 arrays.  I may 
  46. still be wrong, but not, I believe, for the reason you gave.
  47.  
  48.     -P.
  49. -- 
  50. ************************f*u*cn*rd*ths*u*cn*gt*a*gd*jb************************
  51. Peter S. Shenkin, Box 768 Havemeyer Hall, Dept. of Chemistry, Columbia Univ.,
  52. New York, NY  10027;  shenkin@still3.chem.columbia.edu;  (212) 854-5143
  53. ***************** Watch this space for an important message ******************
  54.