Xref: utzoo comp.lang.fortran:855 comp.lang.c:11042 Path: utzoo!attcan!uunet!wyse!vsi1!ubvax!ames!mailrus!uflorida!gatech!udel!rochester!pt.cs.cmu.edu!speech2.cs.cmu.edu!jgk From: jgk@speech2.cs.cmu.edu (Joe Keane) Newsgroups: comp.lang.fortran,comp.lang.c Subject: Re: Should I convert FORTRAN code to C? Keywords: language conversions, complex, 2-d arrays Message-ID: <2130@pt.cs.cmu.edu> Date: 30 Jun 88 22:31:59 GMT References: <2742@utastro.UUCP> <20008@beta.UUCP> <224@raunvis.UUCP> <1189@mcgill-vision.UUCP> <20454@beta.lanl.gov> Sender: netnews@pt.cs.cmu.edu Followup-To: comp.lang.fortran Organization: Carnegie Mellon Computer Science Lines: 26 In article <20454@beta.lanl.gov> jlg@beta.lanl.gov (Jim Giles) shows he hasn't used C. >Any routine that gets a 2-d array as an argument must assume that it is >either static (which restricts you one way), or it must assume that it >is dynamic (in which case it IS a pointer-to-pointer etc.). Whether an array is static or dynamic has nothing to do with whether it contains arrays or pointers. >[various implications of this assumption] >By the way, I've not seen any C compilers which optimize static 2-d >arrays anyway. So you've not seen any C compilers. Given `static foo[10][10][10]' the reference `foo[2][0][7]' is a single address. If foo were a parameter the reference would be a single offset. But see for yourself. >As a result, very similar code is actually >generated whether the array was statically or dynamically allocated. Yes, the same code. --Joe