Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!hc!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.fortran Subject: Re: RE: An array by any other name. . . Message-ID: <3641@lanl.gov> Date: 15 Sep 88 22:25:39 GMT References: <994@amelia.nas.nasa.gov> Organization: Los Alamos National Laboratory Lines: 26 From article <994@amelia.nas.nasa.gov>, by fouts@lemming.nas.nasa.gov.nas.nasa.gov (Marty Fouts): > x[i] and x+i are semantically equivalent. It doesn't matter which way ^^^ > I say it, they both express a reference to the address of the ith > element from the start of x. In some cases, x happens to be a > pointer, in others not. x[i] and *(x+i) are semantically equivalent in C. I don't _want_ them to be. When I ask for an array, I will always use the first syntax. When I ask for a pointer, I will always use the second. With the pointer, I _don't_ want the language to apply any constraints on where it can point; with the array I want array bounds checking - that's two different semantics folks!!! I _want_ two different semantics, C doesn't provide it. The versions of Fortran which presently have a pointer extension _do_ give me separate semantics for pointers than for arrays. I hope the ANSI Fortran committee _doesn't_ standardize on the C model for introducing pointers - Cray Fortran already has the kind of pointer extension I want. 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! Many versions of dynamically allocated 2-d arrays are. In order to get a dynamically allocated to behave semantically like a statically allocated one I have to use a _different_ declaration syntax. J. Giles