Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!bellcore!tness7!tness1!sugar!ficc!peter
From: peter@ficc.uu.net (Peter da Silva)
Newsgroups: comp.lang.fortran
Subject: Re: Fortran versus C for numerical anal
Message-ID: <1553@ficc.uu.net>
Date: 20 Sep 88 14:11:38 GMT
References: <1530@ficc.uu.net> <3746@lanl.gov>
Organization: SCADA
Lines: 48

In article <3746@lanl.gov>, jlg@lanl.gov (Jim Giles) writes:
> From article <1530@ficc.uu.net>, by peter@ficc.uu.net (Peter da Silva):
> > char (*twodarray)[10];
> > 	twodarray = malloc(10*sizeof(*twodarray));
> > 	twodarray[9][5] = 'c';
> > Satisfied?

> No, I still like the Fortran 8x stuff better:
  [ description and assertions that I'm a 'C' fanatic removed ]

Actually I don't much care for 'C's pointer syntax... a postfix syntax
like Pascal's is much cleaner and would get rid of all the nasty aspects
of 'C' declaration syntax. However, no matter how you want to hide it
when you allocate memory dynamically you're dealling with a pointer.

I don't much like the 'C' code I listed above. I much prefer:

> > char (*twodarray)[10][10];
> > 	twodarray = malloc(sizeof(*twodarray));
> > 	(*twodarray)[9][5] = 'c';

because there is a pointer. It is a pointer to a two dimentional array,
but it's a real live pointer. It doesn't matter whether you hide it in the
Fortran syntax or not, there is a cell somewhere that contains the address
of that array and every reference to that cell involves that indirection.

In my ideal syntax, it'd look like this:

> > char twodarray^[10][10];
> > 	twodarray = malloc(sizeof(twodarray^));
> > 	twodarray^[9][5] = 'c';

You can use anything you want for XOR. There are still a couple of spare
characters in 'C'.

> Your declaration syntax above still contains a
> lot of pointer related _junk_ that has nothing to do which what I want
> to declare.

But it has everything to do with what you're doing.

If you have a pointer, call it a pointer. If it's a pointer to an array,
hiding that in the declaration (as in your Fortran example, and as ADA
and PL/I do in their own way) just causes confusion somewhere down the
line.
-- 
Peter da Silva  `-_-'  Ferranti International Controls Corporation.
"Have you hugged  U  your wolf today?"            peter@ficc.uu.net