Should I convert FORTRAN code to C?

Joe Keane jgk at speech2.cs.cmu.edu
Fri Jul 1 08:31:59 AEST 1988


In article <20454 at beta.lanl.gov> jlg at 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



More information about the Comp.lang.c mailing list