Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!nrl-cmf!cmcl2!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.fortran Subject: Re: Fortran versus C for numerical anal Message-ID: <3708@lanl.gov> Date: 17 Sep 88 00:48:01 GMT References: <50500075@uxe.cso.uiuc.edu> Organization: Los Alamos National Laboratory Lines: 41 From article <50500075@uxe.cso.uiuc.edu>, by mcdonald@uxe.cso.uiuc.edu: >> (*twodarray)[10][5] = 'c'; > [... long example showing code generated ...] > > Sure looks like array indexing calculations to me. [...] Still doesn't look like array indexing to me. Now _if_ the parenthesis and asterisk could be removed - then you'd have something. The fact is, the semantics _and_ the syntax should be the same for dynamic and static arrays - the only difference should be a 'dynamic' flag on the declaration and an allocation call. All you've shown me here is an example of the weakness that I've objected to all along - the same semantics but two incompatible syntaxes. This goes along with other dynamic array mechanisms which allow the same syntax but have different semantics. I hope that when Fortran includes a dynamic array capability it will fit more elegantly into the language than C's capability does. Consider the Fortran 8x proposal for allocatable arrays: REAL, ALLOCATABLE :: twodarray (:,:) ... ALLOCATE (twodarray(5,10)) ... twodarray(5,10) = 5.0 ... Note that a _use_ of the 2-d array looks just like the use of any other 2-d array - static or dynamic. The semantics are also identical except that the address of 'twodarray' doesn't become defined until run-time (neither does the size). Any optimization that Fortran could apply to a statically allocated array with unknown extent (like an argument to a function, for example) can be applied to this one in _exactly_ the same way. J. Giles Los Alamos