|
In Pascal, January would neither be 0 or 1, it would be January.
That's what we got high level languages for.
|
|
|
|
|
Think globally; act locally.
|
|
|
|
|
Fortran can define both lower and upper bounds for arrays. Useful in matrix or tensor math.
|
|
|
|
|
I guess that nowadays it can.
Who was it (it could have been Dijkstra) who during the Fortan-77 design discussions, after reviewing the proposed extensions (some of them rather extensive!) commented: "I have no idea what languages are going to look like in year 2000, but they will be called FORTRAN" ?
I came across Fortran 2003 a while ago. I think he hit the nail on the head.
(Most of my Fortran programming was done in Fortran IV. I don't miss it, except as a source of anecdotes about programming and languages.)
|
|
|
|
|
Fortran 2003 is a mess. It has a few good ideas, but in trying to be everything for everyone, I think it stopped being what it was.
The ability to specify array bounds was present in the WATFOR 77/87 compiler, but I don't know how far back it goes before that. I didn't use it when I was writing code for NASA with f77, so I don't know if that suppored it or not. And since then, I've tried to avoid it. I can write Fortran in any language, and I choose not to.
|
|
|
|
|
Zero based and One based work great for talking about arrays.
To me the real issue is in talking about the indices.
How do you talk about the first element/index?
1 based array - first
0 based array - ?
How do you talk about the second element/index?
1 based array - second
0 based array - ?
When I used to teach C programming, I would just append "-eth" to the ordinal number of the index.
How do you talk about the first element/index?
1 based array - first
0 based array - zero-eth
How do you talk about the second element/index?
1 based array - second
0 based array - one-eth
The students (usually with a pre-dotNet Visual Basic background) picked up on this device quickly.
|
|
|
|
|
in Ada you can have -index values, for example an array with indexes in the range (-5..5)
David
|
|
|
|
|
|
Do you know when Fortran got the option to specify the lower index limit?
In "classical" Fortran, arrays indexes always started at 1. I am quite sure that didn't change in Fortran-77; I never read the Fortran 90 standard (and Wikipedia doesn't give enough detail).
Nostalgia: The MIX3 instruction on the 16-bit NORD minicomputers, which subtracted 1 from the accumulator and multiplied by 3. It was made especially made for FORTRAN. NORD used a 48 bit floating point format (3 16 bit words). So MIX3 converted from a FORTRAN logical index to the word offset (the machine was word, not byte, adressable) of the floating point array element. The "multiply by 3" part was done by shifting one left and adding, so it was a lot faster than using the general multiply instruction.
|
|
|
|
|
I made use of it in the WATFOR 77/87 compiler in grad school, but I don't know how far back the capabilty goes before that. I don't know about f77, as I didn't need to use that feature in the code I was writing for it.
I'm afraid the NORD minicomp is a bit before my time But then, integer math is always easier than floating point. I've tried to write a continued fraction integer based representation of floating point arithmetic in C++, but set it aside when I realized that taking the reciprocal was introducing floating point roundoff into the caluclations, and didn't have the patience to figure out how to fix it. I wasn't doing it for size or speed, but to try to eliminate roundoff error, so my efforts had come full circle at that point.
Maybe I should have written it in Fortran instead?
|
|
|
|
|
I try to use the word 'index' when referring to something that starts at zero, and 'position' when referring to something that starts at one.
|
|
|
|
|
How would you number index cards?
|
|
|
|
|
What's an index card? I jokingly tell people I got into writing software because I'm left handed and can't write for beans.
|
|
|
|
|
|
I'm not a race car fan but I know how to spell 'Race car' backwards.
|
|
|
|
|
Does guessing count or must i be a fan?
Loading signature...
. . . Please Wait . . .
|
|
|
|
|
Guessing counts of course.. I got 50% right, and I am kind of Ferrari fan, and missed one..
The signature is in building process.. Please wait...
|
|
|
|
|
I got 40% correct! I only expected to get 1 right (maybe) - so I am happy. Good old Cortina Mk I.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
I got 50% right by guessing every answer.
|
|
|
|
|
Here the same.
Veni, vidi, vici.
|
|
|
|
|
50%. Plus I had a Lotus Cortina for a while. Great cars.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
Those who seek perfection will only find imperfection
nils illegitimus carborundum
me, me, me
me, in pictures
|
|
|
|
|
I ran into a GDI+ bug, which will cause us a lot of pain getting around it. Alright, gotto deal with it, well let's report it at connect.microsoft.com. Fill in the fields, try to submit. Wait for minutes, and then back to the form. No error message about any field being incorrectly filled, nothing. So first I'm wasting time trying to find the cause of this GDI+ bug, and now I'm wasting time trying to tell MS about the bug.
Wout
|
|
|
|
|
What's the (GDI+) bug?
--Carlo the curious
Veni, vidi, vici.
|
|
|
|
|
|
Oh, interesting. Thank you.
Veni, vidi, vici.
|
|
|
|