4 ms·
> 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
by kgwgk 8y ago
> 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.
http://exple.tive.org/blarg/2013/10/22/citation-needed/ http://exple.tive.org/blarg/2013/10/22/citation-needed/
- peatmoss 8y agoWow, I hadn’t seen this before. The history of this feud goes back before C. Thank you for a fascinating read!
- jandrese 8y agoEven Dijkstra weighed in on this: http://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF http://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF
- e12e 8y agoI've always found this a rather weak argument - he even implies that 2...12 is at least as clear (it being the starting point of the text). I also thought I'd seen a longer text focusing more on the counting/indexing. I still don't see the appeal of "element at zero offset" vs simply "first element". I do agree that < vs <= etc can get messy. But outside of now fairly archaic programming languages I don't see the need. Just use a construct that handles ranges, like "for each element in collection/range/etc". (Or for math, "pattern matching" (or "for n in 1..m").
- disgruntledphd2 8y agoI believe that may be cited in the article (but its not in an obvious place :) )
- danso 8y agoThis was a fantastic (and relevant) read, thank you for sharing it.
- romwell 8y agoThanks for the great article. An unexpected takeaway: Michael Chastain's time-traveling debugging framework, which he had in 1995, and which still reads like sci-fi from the future[1]. Alas, this quote will probably stay relevant for a while: >[We keep] finding programming constructs, ideas and approaches we call part of “modern” programming if we attempt them at all, sitting abandoned in 45-year-old demo code for dead languages. [1]http://lwn.net/1999/0121/a/mec.html http://lwn.net/1999/0121/a/mec.html
- ptx 8y agoVery strange article. The first part builds suspense for the great truth that's going to be revealed by the author's extensive research, insisting that it's not something as simple as pointer arithmetic. Then the second parts quotes the creator of BCPL, revealing – a-HA! – what we already knew, that the array is a pointer to the first element and the index is the offset from the pointer, and that's why it's zero. (And after that it veers of into complaining about how the papers documenting this history cost too much money, so they didn't actually read them.)