levy@ttrdc.UUCP (Daniel R. Levy) (03/26/86)
In article <150@sdchema.sdchem.UUCP>, tps@sdchem.UUCP (Tom Stockfisch) writes: >[] >Joe Yao replies >>I don't really see what the problem is that people are moaning >>about. If you want a pointer to the array, the array name itself >>coerces to a pointer containing the memory location at the beginning >>of the array. There is no such thing as a pointer to the whole >>array: that is a Pasqualische or Fortranian notion. 'Scuse me, can somebody educate me as to why that would be a "Fortranian" (I withhold opinion on the Pascal allegation) notion? I was under the impression that most, if not all, Fortrans implement array references pretty much the same way that C does: by reference to the address of the first element in the array, with offsets computed according to the subscripts and then automatically dereferenced for use. The only differences I could see is in argument passing where C can pass things by value, whereas Fortran must pass by reference. FORTRAN C INTEGER I(1000) <--> int i[1000]; J = I(50) <--> int j = i[49]; I(3) = 8 <--> i[2] = 8; CALL FOO(I) <--> foo(i); /* pass address of first element */ CALL FOO(I(3)) <--> foo(&i[2]); /* or of another? */ ... ... SUBROUTINE FOO(K) <> foo(k) /* and dereference on the "other side" */ INTEGER K(1000) int k[1000]; { WRITE(*,*)K(3) printf("%d\n",k[2]); ... ... END } -- ------------------------------- Disclaimer: The views contained herein are | dan levy | yvel nad | my own and are not at all those of my em- | an engihacker @ | ployer or the administrator of any computer | at&t computer systems division | upon which I may hack. | skokie, illinois | -------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, vax135}!ttrdc!levy