[TUHS] Array index history

ARJANEN Loïc Jean David arjanen.loic at gmail.com
Thu Jun 8 11:58:25 AEST 2017

Le jeudi 8 juin 2017, Arthur Krewat <krewat at kilonet.net> a écrit :

> On 6/7/2017 3:03 PM, Ron Natalie wrote:
>> Why go to the trouble of decrementing the index to retreive the first
>>> entry?
>> What makes you think that you have to decrement the index.    Don't get
>> sucked up in the idiotic C implementation of an array.   Arrays can be
>> efficiently implemented no matter where the index starts.
>> In the days when memory and clock cycles were costly, an extra decrement
> or subtract was not something to be taken lightly :)

I doubt that avoiding a decrement was really the reason. I mean, it's an
array: if you're 0-basing it you're still paying a decrement but for bounds
checking this time. Keeping as close as possible to how the target machine
worked or following a convention in another hand, that I can see.


ARJANEN Loïc Jean David
“Computer science is no more about computers than astronomy is about
telescopes, biology is about microscopes, or chemistry is about beakers and
test tubes. Science is not about tools. It is about how we use them, and
what we find out when we do.”
Michael R. Fellows and Ian Parberry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20170608/ed8bc2da/attachment.html>

More information about the TUHS mailing list