home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / fortran / 2858 < prev    next >
Encoding:
Text File  |  1992-07-28  |  2.4 KB  |  93 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!giaeb!simon
  3. From: simon@giaec.cc.monash.edu.au (simon shields)
  4. Subject: dynamic arrays in fortran
  5. Message-ID: <simon.712365484@giaeb>
  6. Keywords: f77,HP-UX,720
  7. Sender: news@monu6.cc.monash.edu.au (Usenet system)
  8. Organization: Monash University, Melb., Australia.
  9. Date: Tue, 28 Jul 1992 23:18:04 GMT
  10. Lines: 81
  11.  
  12. SYSTEM: HP-UX giaec A.08.07 A 9000/720 2001133857
  13. Hi Thanks for all the replies on my question concerning adjustable
  14. arrays.
  15.  
  16. They all basically told me that the compiler was right because
  17. adjustable arrays will only work if the array with its size are sent
  18. as a parameter. i.e.
  19.  
  20.        integer siz
  21.        parameter (siz=100)
  22.        real arr(siz)
  23.        call adj_arrays(arr,siz)
  24.        ..
  25.        ..
  26.        subroutine adj_arrays(arr,siz)
  27.        integer siz
  28.        parameter (siz=100)
  29.        real arr(siz)
  30.  
  31. In the hp manual page 2-31 it has a paragraph titled "Dynamic Arrays"
  32. it says quote 
  33.     "An array that is a nonstatic local variable is called a dynamic
  34.     array. For a dynamic array sorage is allocated by the current
  35.     subprogram dynamically on the stack. This dynamic array feature is
  36.     an HP extension to the ANSI 77 standard..."
  37.  
  38.     then it gives the example
  39.  
  40.  
  41.       program main
  42.       i=10
  43.       call routine (i)
  44.       end
  45.  
  46.       subroutine routine (i)
  47.       integer dyn_array(i)
  48.       dyn_array(i)=i
  49.       end
  50.  
  51. I tried this, it produced
  52. eg.f:
  53.    MAIN main:
  54.    routine:
  55. Declaration error on/above line 10 of eg.f;  for dyn_array; adjustable dimension on non-argument
  56.  
  57. f77: Error.  No assembly.
  58. f77: Errors detected, no link
  59.  
  60. Which is what you'd expect for standard F77, so i tried 
  61. $STANDARD_LEVEL SYSTEM
  62.       program main
  63.       i=10
  64.       call routine (i)
  65.       end
  66.  
  67.       subroutine routine (i)
  68.       integer dyn_array(i)
  69.       dyn_array(i)=i
  70.       end
  71.  
  72. $STANDARD_LEVEL SYSTEM - is a compiler option page 7-71 
  73.     "indicates Fortran 77 plus additional system dependent features
  74.     added to the language."
  75.  
  76. i get
  77. eg.f:
  78. Warning on line 1 of eg.f: unknown inline compiler option
  79.    MAIN main:
  80.    routine:
  81. Declaration error on/above line 10 of eg.f;  for dyn_array; adjustable dimension on non-argument
  82.  
  83. f77: Error.  No assembly.
  84. f77: Errors detected, no link
  85.  
  86. So I guess thats my problem. The compiler on our system
  87. HP-UX giaec A.08.07 A 9000/720 2001133857
  88. doesn't know the compiler directive.
  89.  
  90. Thanks again for all those that helped.
  91. Possibly the only people that could unravel this problem is HP.
  92.  
  93.