Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!teknowledge-vaxc!sri-unix!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.fortran Subject: Re: An array by any other name. . . Message-ID: <423@quintus.UUCP> Date: 17 Sep 88 08:43:19 GMT References: <13587@mimsy.UUCP> <3698@lanl.gov> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 38 In article <3698@lanl.gov> jlg@lanl.gov (Jim Giles) writes: >From article <13587@mimsy.UUCP>, by chris@mimsy.UUCP (Chris Torek): >>>Furthermore, in C x[i][j] is _supposed_ to be semantically equivalent >>>to *(*(x+j)+i). Statically allocated 2-d arrays aren't implemented >>>this way! >> Ah, but they are. >Ah, but they aren't! The two notations are in fact identical, not because statically allocated 2-d arrays are full of pointers (they aren't) but because dynamically allocated ones aren't either. A previous posting of mine explained how the equivalence x[i][j] === *(*(x+i)+j) works. Try it with a compiler! >>[dynamically allocated arrays in Fortran] >Ah, but they _will_ almost certainly exist in the upcoming Fortran. >And I'll be willing to bet that the only difference between such dynamic >arrays and their static counterparts will be a tag on the declaration >and an allocation call. The use will be identical! DECLARE P POINTER; DECLARE (N INITIAL(20), I, J) BINARY FIXED; DECLARE (X, Y, Z) FLOAT; DECLARE ( LOCAL AUTOMATIC, IMPLICIT_DYNAMIC BASED(P), EXPLICIT_DYNAMIC BASED )(1:N, 1:N) FLOAT; ... X = LOCAL(I, J); Y = IMPLICIT_DYNAMIC(I, J); /* Note no mention of P */ Z = P->EXPLICIT_DYNAMIC(I, J); /* Note P-> is required */ Which being translated means "it's been done before". It is not immediately clear to me that hiding the pointer P is *always* a good idea; it really didn't make debugging PL/I code any easier. PL/I is not a language that springs to mind when one thinks "high performance". Was it that people didn't try hard enough, or are there fast *full* PL/I systems, or is Fortran 8X doomed by the resemblance?