5 ms·
TL;DR: "So: the technical reason we started counting arrays at zero is that in the mid-1960′s, you could shave a few cycles off of a program’s compilation time
by RyanMcGreal 13y ago
TL;DR:
"So: the technical reason we started counting arrays at zero is that in the mid-1960′s, you could shave a few cycles off of a program’s compilation time on an IBM 7094. The social reason is that we had to save every cycle we could, because if the job didn’t finish fast it might not finish at all and you never know when you’re getting bumped off the hardware because the President of IBM just called and fuck your thesis, it’s yacht-racing time."
- k__ 13y agoreally? I thought the reason is that the index is simply a memory offset. :\ a[0] always meant something like "get me the data whre a is pointing to" a[1] meant "get me the data 1-offset next to where a is pointing to"
- VLM 13y agoTraditionally this is taught to noobs on a blackboard or I suppose powerpoint now. One based indexes are just going to confuse the noobs even worse. "So a[2] means get me the data offset by one from a" "uh what, don't you mean offset by two?" "No somebody said pointer arithmetic would be simpler if you had to memorize a bunch of different times to add or subtract one, just as a barrier to entry". "Oh well that sucks. Someone should invent a zero indexed array language..."
- k__ 13y agoHum, funny... I always thought about arrays as pointers (at least in C), like it's just syntactical sugar for specific kind of pointer.