home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / fortran / 4729 < prev    next >
Encoding:
Text File  |  1992-12-15  |  2.4 KB  |  61 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!stanford.edu!unixhub!slacvx.slac.stanford.edu!fairfield
  3. From: fairfield@slacvx.slac.stanford.edu
  4. Subject: Re: SUMMARY: CHARACTER FUNCTION as dummy argument
  5. Message-ID: <1992Dec15.111717.1@slacvx.slac.stanford.edu>
  6. Lines: 49
  7. Sender: news@unixhub.SLAC.Stanford.EDU
  8. Organization: Stanford Linear Accelerator Center
  9. References: <BURLEY.92Dec15044825@apple-gunkies.gnu.ai.mit.edu>
  10. Date: Tue, 15 Dec 1992 19:17:17 GMT
  11.  
  12.     A few comments on Craig Burley's summary:
  13.  
  14. In article <BURLEY.92Dec15044825@apple-gunkies.gnu.ai.mit.edu>, burley@apple-gunkies.gnu.ai.mit.edu (Craig Burley) writes:
  15.  
  16. First:
  17. [...]
  18. > If anyone has a system that supports the code in Sample 1 (like VAX/VMS
  19. > FORTRAN), it'd be interesting to see how well it handled the following:
  20. > C Sample 6
  21. >     CHARACTER*(*) CFUNC
  22. >     EXTERNAL CFUNC
  23. >     CALL X (CFUNC)
  24. >     PRINT *, 'Done!'
  25. >     END
  26.  
  27. VAX Fortran rejects this at compile time, to wit (I called the source file
  28. BURLEY.FOR, thus BURLEY$MAIN):
  29.  
  30. 00001       CHARACTER*(*) CFUNC
  31. 00002       EXTERNAL CFUNC
  32. 00003       CALL X (CFUNC)
  33. 00004       PRINT *, 'Done!'
  34. 00005       END
  35. %FORT-F-ADJLENUSE, Passed length character name used in invalid context 
  36.      [CFUNC] in module BURLEY$MAIN 
  37.  
  38. The rest of Sample 6 compiled fine...
  39.  
  40.     I won't comment on whether or not the VAX way of passing character
  41. arguments (functions and/or variables) is efficient or not since someone
  42. like Steve Lionel is in a _much_ better position to answer (although I
  43. do suspect there's no performance hit on VMS because ALL character
  44. entities are passed by [the address of a] descriptor).  However, while I do
  45. appreciate issues of efficiency in Fortran code, CHARACTER manipulations
  46. are one place I think we should "look the other way", so to speak.  These
  47. manipulation most often occur in the user interface, and users are SLOW
  48. DEVICES ;-)  Furthermore, if you DO need efficient character manipulation,
  49. try recoding using the equivalent of Hollerith data: it's MUCH faster to
  50. compare INTEGER variables, even in a loop, than to compare CHARACTER
  51. variables.  (Well, I admit there is likely hardware dependency in this...).
  52.  
  53.     Cheers, Ken
  54. --
  55.  Dr. Kenneth H. Fairfield    |  Internet: Fairfield@Slac.Stanford.Edu
  56.  SLAC, P.O.Box 4349, MS 98   |  DECnet:   45537::FAIRFIELD (45537=SLACVX)
  57.  Stanford, CA   94309        |  BITNET    Fairfield@Slacvx
  58.  ----------------------------------------------------------------------------
  59.  These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
  60.