Le jeudi 8 juin 2017, Arthur Krewat <krewat@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.
Loïc
--
ARJANEN Loïc Jean David
http://blog.luigiscorner.com---
“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