Xref: utzoo comp.lang.fortran:779 comp.lang.c:10808
Path: utzoo!attcan!uunet!husc6!uwvax!oddjob!ncar!noao!arizona!naucse!rrr
From: rrr@naucse.UUCP (Bob Rose )
Newsgroups: comp.lang.fortran,comp.lang.c
Subject: Re: Should I convert FORTRAN code to C?
Summary: What gives???
Keywords: language conversions, FORTRAN, c
Message-ID: <738@naucse.UUCP>
Date: 19 Jun 88 23:35:57 GMT
References: <2742@utastro.UUCP> <20008@beta.UUCP> <224@raunvis.UUCP> <20340@beta.lanl.gov>
Organization: Northern Arizona University, Flagstaff, AZ
Lines: 43

In article <20340@beta.lanl.gov>, jlg@beta.lanl.gov (Jim Giles) writes:
> In article <224@raunvis.UUCP>, kjartan@raunvis.UUCP (Kjartan Pierre Emilsson Jardedlisfraedi) writes:
> >   Now here there seems to be a little misunderstanding.  I have never
> > understood why Fortran users keep saying that array indexing is awkward
> > in C.
> > [...]
> 
> Awkward isn't the problem.  I don't like the double bracket notation,
> but anyone can write a macro to turn ARRAY(i,j,k) into array[i][j][k].
> The Problem is that 2-d arrays are not optimizable because they are
> immediately turned into pointer-to-pointer-to-data type of constructs.

Ok, what gives. Some else post the following code (not exact but close enough)

	real a(5,2)
	...
	call foo(a)
	...
	end

	subroutine foo(a)
	real a(10)
	...

Now doesn't the following c code work to do the same

	double a[2][5]        /* <-- note [2][5] not [5][2] */
	...
	foo(a)
	...
	}

	void foo(a)
	double a[10]
	{

If it is not the same, would someone please post or email a counter
example. I would like to see what is wrong.

Note there are problems if you dynamicly allocate arrays but you cannot
dynamicly allocate arrays in fortran so this is a void arguement.

                               -bob