home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / fortran / 4836 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.8 KB  |  45 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!timbuk.cray.com!walter.cray.com!craywr!wws
  3. From: wws@craywr.cray.com (Walter Spector)
  4. Subject: Re: Dynamic Memory Allocation in FORTRAN, Question
  5. Message-ID: <1992Dec22.133600.1380@walter.cray.com>
  6. Lines: 32
  7. Sender: wws@craywr (Walter Spector)
  8. Nntp-Posting-Host: craywr.cray.com
  9. Organization: Cray Research, Inc.
  10. References: <Dec.20.02.22.20.1992.7312@spade.rutgers.edu>
  11. Date: 22 Dec 92 13:35:59 CST
  12.  
  13. In article <Dec.20.02.22.20.1992.7312@spade.rutgers.edu>, xiong@spade.rutgers.edu (Xiong) writes:
  14. |> Hi, I am wondering if it is possible to allocate memory dynomically in
  15. |> FORTRAN as in C?
  16.  
  17. There are no Standard mechanisms in the Fortran-77 Standard for performing
  18. dynamic memory management.  Standard non-Standard ways of doing it usually
  19. involve overindexing blank common or some form of pointers combined with
  20. with a sbrk(2)-like or malloc(3c)-like interface.  Performing your own
  21. sbrk system calls is obviously dangerous in a Unix-like environment,
  22. calling a malloc-like routine is more reliable.
  23.  
  24. In a compiler with Fortran-90 memory management, there are two Standard
  25. options: Automatic arrays which are very nice for scratch arrays,
  26. and ALLOCATABLE variables combined with the ALLOCATE/DEALLOCATE statements
  27. which give a more general capability.  (Note that in Fortran-90, pointers
  28. would generally not be used for memory management.)  Compilers exist which
  29. support one or both of these facilities.
  30.  
  31. Your compiler system will probably support one or more of the above
  32. techniques.  RTFM for more details.
  33.  
  34. |> Thanks a lot for your help. If this question has been asked before (I
  35. |> did not find it in the FAQ)
  36.  
  37. This really is a FAQ and should be included.  Keith?
  38.  
  39. Walt
  40. ----
  41. Walt Spector
  42. (wws@renaissance.cray.com)
  43. Sunnyvale, California
  44. _._ _._ _.... _. ._.
  45.