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

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uimrl7.mrl.uiuc.edu!ercolessi
  3. From: ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi)
  4. Subject: Re: Dynamic Memory Allocation in FORTRAN, Question
  5. References: <Dec.20.02.22.20.1992.7312@spade.rutgers.edu> <1992Dec20.233539.4905@sol.ctr.columbia.edu>
  6. Message-ID: <BzL8tz.H5u@news.cso.uiuc.edu>
  7. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  8. Reply-To: ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi)
  9. Organization: MRL - UIUC
  10. Date: Mon, 21 Dec 1992 02:41:57 GMT
  11. Lines: 33
  12.  
  13. In article <1992Dec20.233539.4905@sol.ctr.columbia.edu>, shenkin@still3.chem.columbia.edu (Peter
  14. Shenkin) writes:
  15. |>In article <Dec.20.02.22.20.1992.7312@spade.rutgers.edu>
  16. |> xiong@spade.rutgers.edu (Xiong) writes:
  17. |>>Hi, I am wondering if it is possible to allocate memory dynomically in
  18. |>>FORTRAN as in C? 
  19. |>
  20. |>No.
  21.  
  22. We are a bit negative, aren't we?  :-)
  23.  
  24. Well, if you stick to the FORTRAN standard the answer is no
  25. [of course, Fortran is another story].
  26. But there might be vendor extensions that may allow dynamic
  27. or almost-dynamic arrays.  One of them is the AUTOMATIC
  28. declaration, that is quite popular on RISC architectures
  29. (e.g., SGI, IBM RS/6000, DEC MIPS).  Storage space for variables 
  30. declared to be AUTOMATIC in a certain subroutine is created
  31. when the subroutine is entered, and deleted upon exit.
  32. So it's not as flexible as in C, in the sense that the lifetime
  33. of the variable must coincide with the subroutine execution,
  34. and the variable size must be known at compile time.
  35. Still, if your purpose is to avoid wasting memory, it does
  36. the job nicely.  
  37.  
  38. There may be other schemes implemented by other vendors,
  39. and one can also attempt a mixed language implementation but
  40. this goes beyond the original question. 
  41. --
  42. Furio Ercolessi
  43. Materials Research Laboratory           |   Intl School for Advanced Studies
  44. Univ. of Illinois at Urbana-Champaign   |   Trieste, Italy
  45. furio@uiuc.edu                          |   furio@sissa.it
  46.