|
They left out being able to choose any positive integer for the starting index.
Still I vote for array indexes starting at zero.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
I was *that* close to adding a "other" option on the poll.
But I knew that would just confuse the issue
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
Only the true comedians here would have selected it.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Well the universe is homogeneous, why shouldn't be the arrays?
Yes, I'm one of the true...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
|
You can in Ada, if I remember rightly, or with a negative number, but though it seems clever when you do it, the code is unmaintainable. But that goes for Ada most of the time anyway.
------------------<;,><-------------------
|
|
|
|
|
CIDev wrote: Still I vote for array indexes starting at zero.
Surely zero is neither positive or negative.
|
|
|
|
|
Why stop with positive. Pascal let you do something like this:
Example = Array[-5..5] of Integer;
3x12=36
2x12=24
1x12=12
0x12=18
|
|
|
|
|
Ahhhhhh. I still remember my love affair with (Turbo) Pascal. What a beauty.
|
|
|
|
|
There is only one "old school" language and it ain't C or Basic
|
|
|
|
|
Nemanja Trifunovic wrote: There is only one "old school" language
Yeah! COBOL...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
OriginalGriff wrote: COBOL
COBOL is a recent fad. FORTRAN is the first real programming language.
|
|
|
|
|
Nemanja Trifunovic wrote: FORTRAN is the first real programming language.
Closely followed by Lisp.
/ravi
|
|
|
|
|
Ravi Bhavnani wrote: Closely followed by Lisp.
t
Strictly speaking, boolean literals didn't exist in original LISP
|
|
|
|
|
Ravi Bhavnani wrote: Closely followed by Lisp
What about assembler?
That's the 'real' programming language. Other are artificial; everything in them is a convention, so it is starting from 0 or 1, or ever from 2
|
|
|
|
|
Nemanja Trifunovic wrote: There is only one "old school" language and it ain't C or Basic
PL1
|
|
|
|
|
Let me whip out my punch cards here...
|
|
|
|
|
True old school programmers know it ain't Fortran 77 either.
3x12=36
2x12=24
1x12=12
0x12=18
|
|
|
|
|
|
It should start at 3.1415926535 or Pi
luisnike19
|
|
|
|
|
luisnike19 wrote: It should start at 3.1415926535 or Pi
That's irrational
|
|
|
|
|
Not enough precision to be practical.
|
|
|
|
|
It should be consistent across programming languages, regardless of whether they are low or high level, otherwise it'll be a recipe for confusion amongst programmers who use a variety of languages. The underlying memory allocation is zero-based, so it makes sense to leave it that way.
|
|
|
|
|
Which of course is nought. Except on Thursdays.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|