From: Gib Bogle on
Steven Correll wrote:

> #include <stdio.h>
> #include <stdlib.h>
>
> int
> main(int argc, char **argv) {
> int xdim = argc;
> int ydim = argc + 1;
> float (*parray)[xdim][ydim] = malloc(xdim * ydim * sizeof(float));
> for (int x = 0; x < xdim; x += 1) {
> for (int y = 0; y < ydim; y += 1) {
> (*parray)[x][y] = 10 * x + y;
> }
> }
> for (int x = 0; x < xdim; x += 1) {
> for (int y = 0; y < ydim; y += 1) {
> printf("%g ", (*parray)[x][y]);
> }
> printf("\n");
> }
> return 0;
> }

It's a bit inconvenient that an array element must be accessed as
(*parray)[x][y], and also a bit confusing since this is not required in the case
of the old 1-D array.
float (*b)[10] = malloc(10*sizeof(float));
and
float *b = malloc(10*sizeof(float));
have the same effect, but in the latter case the elements are accessed by b[i],
while in the former by (*b)[i].
From: Thomas Koenig on
Phillip Helbig wrote:
> In article <i0hu98$ocp$1(a)speranza.aioe.org>, Jugoslav Dujic
><jdujic(a)yahoo.com> writes:
>
>> On 29.06.2010. 23:22, Colin Watters wrote:
>> > Here is an even more dated paper (1893) comparing Fortran and some other
>> > languages:
>>
>> Jeez, I didn't know Fortran is *THAT* old :o)
>
> FORTRAN IV even had a Roman numeral. :-)

The nice thing about Roman numbers is that you can't have a division by
zero error.
From: Thomas Koenig on
On 2010-07-01, glen herrmannsfeldt <gah(a)ugcs.caltech.edu> wrote:

> I have written assembler for many machines and x86 is my least
> favorite.

Ever written assembler for 6502? ;-)
From: glen herrmannsfeldt on
Thomas Koenig <tkoenig(a)netcologne.de> wrote:
> On 2010-07-01, glen herrmannsfeldt <gah(a)ugcs.caltech.edu> wrote:

>> I have written assembler for many machines and x86 is my least
>> favorite.

> Ever written assembler for 6502? ;-)

S/360, S/370, PDP-10, PDP-11, VAX, 6809, but not much 6502.
I did write a disassembler for 6502, though, and I do remember
some interesting things about the instruction set.

But most of my complaints about x86 are with the assembler
itself, and not so much the instruction set. I am not sure
by now how much of that is Intel, MS, or others along the way.

The 6502 doesn't have that many addressing modes, which reduces
the ways to go wrong in the assembler. The one I remember is
that subroutine calls push one less than the address of the
next instruction on the stack, and return goes to one more
than the address it pops off. You see this with jump tables
that push an address from a table on the stack, and then RET.
All the table entries are off by one.

-- glen
From: Richard Maine on
Thomas Koenig <tkoenig(a)netcologne.de> wrote:

> On 2010-07-01, glen herrmannsfeldt <gah(a)ugcs.caltech.edu> wrote:
>
> > I have written assembler for many machines and x86 is my least
> > favorite.
>
> Ever written assembler for 6502? ;-)

I have. I don't recall it as being particularly bad. Not very powerful,
but easy enough. In fact, I've even written "machine language" for it in
a context where I didn't have an asembler available. That was for a
hobby project that I once did quite a while ago. I put together a
computer of sorts on a pair of breadboards. One breadboard was a "video
card" using a 6845 video controller. The other was CPU, RAM, PROM, and a
parallel I/O controller for a keyboard. I had a commercial keyboard and
monitor. I'd burn my programs into the prom without benefit of an
assembler. Never did anything serious with it; just played around.

I might also note that I find it a pretty narrow viewpoint to assume, s
one poster seems to do, that Fortran code is going to be targetting x86.
I've written Fortran code for an awful lot of systems, x86 being in a
minority. As I'm now retired and have only my home systems, the X86
fraction has gone way up, but it was a minority when I was working for a
living, which wasn't that awfully many years ago. At home, my Apple 2e
still works, but I seldom drag it out and haven't programmed for it in a
long time. I do have a PPC Mac mini, but I don't program for it.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain