home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / vms / 21656 < prev    next >
Encoding:
Text File  |  1993-01-21  |  3.4 KB  |  65 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!haven.umd.edu!decuac!pa.dec.com!engage.pko.dec.com!e2big.mko.dec.com!dbased.nuo.dec.com!quark.enet.dec.com!lionel
  3. From: lionel@quark.enet.dec.com (Steve Lionel)
  4. Subject: Re: Recursion in FORTRAN
  5. Message-ID: <1993Jan21.195804.6787@dbased.nuo.dec.com>
  6. Lines: 52
  7. Sender: news@dbased.nuo.dec.com (USENET News System)
  8. Reply-To: lionel@quark.enet.dec.com (Steve Lionel)
  9. Organization: Digital Equipment Corporation, Nashua NH
  10. References: <1jj8enINNqik@gap.caltech.edu> <1993Jan20.180757.2587@pony.Ingres.COM> <1993Jan20.195642.13310@dbased.nuo.dec.com> <1993Jan21.092628@mccall.com>
  11. Date: Thu, 21 Jan 1993 19:58:04 GMT
  12.  
  13.  
  14. In article <1993Jan21.092628@mccall.com>, tp@mccall.com (Terry Poot) writes:
  15. |>In article <1993Jan20.195642.13310@dbased.nuo.dec.com>,
  16. |>lionel@quark.enet.dec.com (Steve Lionel) writes:
  17. |>>As of DEC Fortran V6.0 on OpenVMS (currently shipping on Alpha AXP systems,
  18. |>>soon to come on VAX), SAVE will NOT be a no-op.  So be sure to use it if you
  19. |>>want the value saved upon exit from the routine.  Note that SAVE does not
  20. |>>necessarily mean "static allocation"; there is a STATIC statement for that.
  21. |>>(In practical terms, SAVE does cause static allocation, but you should say
  22. |>>what you mean and mean what you say.)
  23. |>
  24. |>I want to be real clear about this (I hear the sound of 200,000 lines of legacy
  25. |>fortran code shattering to little bits). As of v6.0, values not explicitly
  26. |>mentioned in a SAVE statement can not be guaranteed to survive from call to
  27. |>call, right? Any qualifiers to preserve the current behavior?
  28. |>
  29.  
  30. Relax.  The default behavior hasn't changed.   The compiler sort of gives you
  31. a free "SAVE" if it can't determine that you always store a variable before
  32. using it.  But if you use /RECURSIVE, then variables not explicitly SAVEd
  33. won't be.  Also, /RECURSIVE will eliminate guaranteed initialization to zero;
  34. I've heard one customer consider this a feature, so as to ferret out hidden
  35. bugs. 
  36.  
  37. However, if you haven't SAVEd a variable, and the compiler can tell that you
  38. definitely use it before storing it, it will give you a warning. 
  39.  
  40. Now what I said about SAVE not meaning "static" is true, though on VAX, at
  41. least, it does force static allocation, even if you use /RECURSIVE.  But the
  42. standard says you should use SAVE if you want the value saved, so put it in
  43. if you mean that - it'll prevent possible surprises in the future and also makes
  44. the intent clearer to someone reading the code.  (I believe that on AXP
  45. systems the same is true, though I know that the optimizer there distinguishes
  46. between "must save before exit" and "static"; this may have no practical
  47. consequence.)
  48.  
  49. Now what I said about VOLATILE is less relaxing - programs which assume that
  50. references to variables in COMMON or dummy arguments are not optimized (that
  51. is, that the compiler ALWAYS refers to the variable through the COMMON or the
  52. argument list), may indeed break if those variables can change value invisibly
  53. to the compiler and are not declared VOLATILE.  The V6 compiler can choose to
  54. copy COMMON variables and some dummy arguments into registers for calculations;
  55. it will write COMMON variables back to the COMMON around routine calls if
  56. necessary.  So if you have an AST routine that modifies a COMMON variable,
  57. declare the variable, or the whole COMMON, VOLATILE.
  58. --
  59.  
  60. Steve Lionel                    lionel@quark.enet.dec.com
  61. SDT Languages Group
  62. Digital Equipment Corporation
  63. 110 Spit Brook Road
  64. Nashua, NH 03062
  65.