Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ecsvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!mcnc!ecsvax!dgary From: dgary@ecsvax.UUCP (D Gary Grady) Newsgroups: net.lang.c Subject: Re: multidimensional arrays Message-ID: <469@ecsvax.UUCP> Date: Mon, 7-Jan-85 12:58:43 EST Article-I.D.: ecsvax.469 Posted: Mon Jan 7 12:58:43 1985 Date-Received: Wed, 9-Jan-85 04:38:26 EST References: <251@harvard.ARPA> Organization: Duke U Comp Ctr Lines: 32 <> A couple of posters (and a few correspondents) have questioned whether FORTRAN permits variably-dimensioned array parameters. That is, does this always work in FORTRAN: SUBROUTINE FOO(ARRAY, R, C) DIMENSION ARRAY(R, C) The answer is yes, it works in all correct FORTRAN compilers. It is a standard feature of the language. It is true that the UCSD p-System FORTRAN doesn't allow that, even though its documentation used to say otherwise. This is because the UCSD p-System FORTRAN compiler stinks. What can I say? BTW, this also works in virtually all FORTRANs with array bounds checking turned off: SUBROUTINE FOO(ARRAY, R) DIMENSION ARRAY(R, 1) Because FORTRAN stores column-major and hence does not need to know the last dimension to perform a subscript calculation. Many, many FORTRAN programs do this, even though its "legality" is open to question. Best, -- D Gary Grady Duke University Computation Center, Durham, NC 27706 (919) 684-4146 USENET: {decvax,ihnp4,akgua,etc.}!mcnc!ecsvax!dgary