|
Well - maybe because: what was Java modeled after ?
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Well, Java was based off C++ so there's that too.
|
|
|
|
|
|
Agreed. I heard through the grapevine that MS even hired some top Java guys to help design C#. Never heard of the VB thing. Methinks its the author's wishful thinking.
Jeremy Falcon
|
|
|
|
|
C# is Java with all the stupid sucked out.
|
|
|
|
|
C# is closer to C++ and Delphi (Turbo Pascal). C# and Delphi has the same father.
|
|
|
|
|
Who cares as long as they don't model anything after time honored VB practices.
Variants, anybody?
|
|
|
|
|
Care for a slice of nested GOTO statements?
|
|
|
|
|
Global variables! Shirley you like global variables!
|
|
|
|
|
How could they possibly have omitted On Error Resume Next from the C# spec?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Simple problems should have simple solutions.
Complex problems should too.
|
|
|
|
|
Arrays start at 1 - just like when counting your fingers.
C# (C, C++...) messed up, who counts anything from zero? It's unnatural, zero simply does not exist.
Sin tack
the any key okay
|
|
|
|
|
Arrays in BASIC have always begun at zero... Though not many practitioners are smart enough to realize it.
|
|
|
|
|
Quote: zero simply does not exist. I have nothing to say to that!
...or in C#...
I have null to say to that!
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
Lopatir wrote: zero simply does not exist.
0 - Wikipedia[^]
Zero is a number and makes perfect sense to use it as an index in a collection/array.
|
|
|
|
|
Slacker007 wrote: makes perfect sense to use it as an index in offset into a collection/array
FTFY
|
|
|
|
|
Lopatir wrote: C# (C, C++...) messed up, who counts anything from zero? It's unnatural, zero simply does not exist.
Uhm, no. The understanding of the number zero was one of the most important discoveries to get mathmatics on the way and that was thousands of years ago. It's not at all as insignificant as you think. Except for BASIC fans, of course.
Then, you are confusing an index with counting. As any machine code or assembly programmer can tell you, you must address the first value in an array at BaseAddress + 0, and the nth value at BaseAddress + ((n-1) * sizeof(type)), or short: The index for the nth element always is (n-1). Except for BASIC fans, of course.
|
|
|
|
|
CodeWraith wrote: Except for BASIC fans, of course.
Some of whom refuse to acknowledge the existence of the zeroth element in their arrays even though it sits there sadly awaiting a value that will never arrive.
|
|
|
|
|
Indexing != counting, no discussion there. I assume that BASIC interpreters and compilers automatically adjusted the index. especially in the days of 8 bit computers they had no memory to waste.
|
|
|
|
|
Have you read the original 1964 spec of BASIC?
|
|
|
|
|
Was there a formal spec back then or has it been written afterwards as for most languages of that time?
|
|
|
|
|
|
There we go. The index values range from 0 to (n-1), as they should. Now at which point did they start with 1? Every early home computer had a BASIC interpreter in a ROM, which in most cases was a customized Microsoft BASIC. Atari developed the BASIC from scratch, and was zero based. Look here.[^] It has been some time since I used that manual, but I should still have it somewhere.
|
|
|
|
|
You may have misread the spec; page 38 says it's 0 to n inclusive. I expect that's why so many developers chose to use 1 to n inclusive and ignore element zero.
Show me a BASIC implementation that has 1-based indices (by default). I have never encountered one.
I do see that Turbo BASIC has an OPTION BASE statement that allows a developer to choose to differ from the default of zero. Turbo BASIC also extends the DIM statement to allow the developer to specify a range, similar to Pascal -- DIM b(50:60) . But the default behaviour is for 0 to n inclusive.
|
|
|
|
|
PIEBALDconsult wrote: 0 to n inclusive
Ok, but what's the reasoning behind that? You dimension an array to n elements and get an array with n + 1 elements.
This really is interesting. Back in the day I did not use BASIC very much. The interpreters were too slow, especially for graphics. When finally a C compiler fell into my hands (on the Atari ST), I never looked back. The whole thing sounds like a misunderstanding that came when everyone and their dogs started to write BASIC programs on their TRS-80s or later on their C64s.
|
|
|
|