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

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!nntp-server.caltech.edu!draco.macsch.com!convex.is.macsch.com!dnl
  3. From: dnl@convex.is.macsch.com (David Lombard)
  4. Subject: Re: function name as an argument
  5. Message-ID: <1992Dec15.015958.26192@draco.macsch.com>
  6. Sender: usenet@draco.macsch.com (Usenet Poster)
  7. Organization: MacNeal-Schwendler Corp.
  8. References: <1992Dec8.051134.5968@news.Hawaii.Edu> <ADK.92Dec12114449@ds2.sun13.SCRI.FSU.EDU> <1992Dec14.150347.17156@e2big.mko.dec.com>
  9. Date: Tue, 15 Dec 92 01:59:58 GMT
  10. Lines: 65
  11.  
  12. In article <1992Dec14.150347.17156@e2big.mko.dec.com> lionel@quark.enet.dec.com (Steve Lionel) writes:
  13. >
  14. >
  15. >Absolutely true.  But even if you compiled all the routines together, what if
  16. >you added another caller of SUB which passed FUNC declared as a different
  17. >length?  Unless you additionally require procedure inlining, there is no way
  18. >that SUB can know which routine called it and which length to statically
  19. >allocate.  This is why the standard requires the length of a character
  20. >function to be declared as an integer constant expression in the program
  21. >unit which calls the function.  And this is why an implementation (such as
  22. >VAX FORTRAN), which does allow the (*) in the referencing unit, passes the
  23. >length along with the routine address, so that it may do run-time allocation
  24. >for the function result.
  25. >--
  26. >
  27. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  28. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  29. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  30. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  31. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  32. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  33. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  34. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  35. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  36. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  37. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  38. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  39. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  40. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  41. NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO!
  42.  
  43. FLAME ON!
  44.  
  45. Learn the language!  This is the second time this (#^&*$* remark has been made.
  46.  
  47. FLAME OFF!
  48.  
  49. PLEASE, read sections 8.4.2 and 15.9.3.1 of the standard.  They explain why
  50. all implementations of the language must maintain and pass around the
  51. length of each character variable.  All implementations must allow the (*)
  52. in subprograms.  This is not some mystical example of the great god VMS.
  53. If an implementation does not support (*), then it is simply non-conforming.
  54.  
  55. Inlining has no bearing on a subrpogram knowing how large a character variable 
  56. is.  The length must be passed.  PERIOD.  Some implementations, such as your 
  57. blessed VAX, pass around a structure describing the string.  Other 
  58. implementations pass two adjacent arguments, the address and the length.  
  59. Others first pass all the addresses then all the lengths.  Others do other 
  60. things.
  61.  
  62. In addition, the result is stored in a statically sized location, i.e. the
  63. variable which is assigned the value of the function.
  64.  
  65.  
  66. A word to the wise, the standard is not a document one can casually read.
  67. The information is `scattered' throughout the document.  One must `swim'
  68. in the standard to understand it.  This is not meant as an impeachment of
  69. the standard, just a statement of fact.
  70.  
  71.  
  72.                       MY COMMENTS, MY OPINIONS.
  73.  
  74. David N. Lombard    The first thing we do,         The MacNeal-Schwendler Corp
  75. dnl@macsch.com      Let's kill all the lawyers.    815 Colorado Blvd
  76. (213) 259-4911      II Henry VI, IV.ii             Los Angeles, CA  90041
  77.