[TUHS] Array index history

Random832 random832 at fastmail.com
Thu Jun 8 23:49:49 AEST 2017


On Wed, Jun 7, 2017, at 15:15, Arthur Krewat wrote:
> 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 :)

You wouldn't need a decrement per access, because the base itself could
still be stored as the address of the "0th" element (i.e. what would be
the "-1th" in a 0-based system). It might add some extra complexity to
the relocator, if it's not currently possible to have a reference
outside the bounds of an object and/or with a negative offset, but
statically linked programs (the only kind on V7 and earlier) did not do
any runtime relocation.


More information about the TUHS mailing list