home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!pa.dec.com!e2big.mko.dec.com!quark.enet.dec.com!lionel
- From: lionel@quark.enet.dec.com (Steve Lionel)
- Subject: Re: adjustable arrays
- Message-ID: <1992Jul28.175947.4626@e2big.mko.dec.com>
- Lines: 51
- Sender: guest@e2big.mko.dec.com (Guest (DECnet))
- Reply-To: lionel@quark.enet.dec.com (Steve Lionel)
- Organization: Digital Equipment Corporation, Nashua NH
- References: <simon.712286479@giaeb>
- Date: Tue, 28 Jul 92 17:59:47 GMT
-
-
- In article <simon.712286479@giaeb>, simon@giaec.cc.monash.edu.au
- (simon shields) writes:
- |>I'm using a
- |>HP-UX giaec A.08.07 A 9000/720 2001133857
- |>machine. I have programs that I wrote that make use of adjustable
- |>dimensions. They worked fine on our previous HP800 type machine, but
- |>come up with a declaration error on the 720's. Do I need a special
- |>switch to enable me to use adjustable dimensions with the f77 command
- |>?
- |>
- |>Thanks
- |>
- |>This is the subroutine that makes use of the adjustable dimension
- |>facility.
- |>
- |> SUBROUTINE graph (coords, curves, fname)
- |> EXTERNAL fill the array
- |> INTEGER coords, curves
- |> LOGICAL fill the array
- |> CHARACTER fname*(*)
- |> REAL xdra (coords,curves), ydra (coords, curves),tr(curves)
- |>ERROR __________^^^^^^^^^^
- |> IF (fill the array (xdra, ydra,tr, coords, curves, fname)) THEN
- |> CALL graph the array (xdra, ydra,tr, coords, curves, fname)
- |> CALL do plt
- |> ELSE
- |> PRINT *,"Couldn't fill the array so graph was NOT done !!"
- |> PRINT *,"Sorry about that !!"
- |> ENDIF
- |> RETURN
- |> END
-
- The Fortran language requires arrays with adjustable bounds to be formal
- arguments themselves. That is, XDRA must be a formal argument to the
- subroutine. (In addition, the bounds expressions must not contain elements
- other than constants or variables which are themselves formals or in
- COMMON.)
-
- What you have tried to do (and also in your subsequent posting) is dynamic
- allocation, which is not supported in most Fortran implementations. If your
- implementation has support for pointers (also non-standard), you can couple
- these with a call to the operating system's memory allocation services
- (eg. C's malloc) to get what you want.
- --
-
- Steve Lionel lionel@quark.enet.dec.com
- Languages Group
- Digital Equipment Corporation
- 110 Spit Brook Road
- Nashua, NH 03062
-