| While I don’t disagree with his argument for preferred conventions in an era of accumulators/gp registers, I am surprised he didn’t call out why Fortran used 1, The IBM 704's index registers were decrementing, subtracting their contents from an instruction's address field to form an effective address. Type A instructions had a three bit tag, indicating which index registers to use. With those three indexes you get Fortran’s efficient 7D column major arrays. This made data aggregation much more efficient and Cray/Cuda/modern column oriented DBs do similar. But for Algol-like languages on PDP inspired hardware I do like his convention, if like the example you have a total ordering on the indexes. But Fortran also changed the way it was taught, shifting from an offset from memory that was indexed down from an address, which makes sense when the number of bits in an address space changes based on machine configuration, to index values. Technically Fortran, at least in word machines meets his convention. pointer + offset <= word < pointer + offset +1
It is just the offset is always negative. |
The use of 1-based indexing was just inherited from the index notation used for vectors and matrices in most mathematical journals at that time.
When IBM 704 was designed (as the successor of IBM 701 and taking into account the experience from IBM NORC), it was designed to allow an efficient implementation of FORTRAN, not vice-versa.
The column-major ordering of FORTRAN allows more efficient implementations of the matrix-vector and matrix-matrix products (by reading the elements sequentially), when these operations are done correctly, i.e. not using the naive dot product definitions that are presented in most linear algebra manuals instead of the useful definitions of these operations (i.e. based on AXPY and on the tensor product of vectors).