Charles Stevenson wrote on May 14, 2005 8:24 AM:

> Do you know why dimensioned arrays were first limited to
> only 1 or 2 dimensions in Pick or Info-Basic?

I started my computing life with BASIC on a PDP-11/03 and FORTRAN on a CDC
Cyber 173 system.  I believe the dimension limit was there to avoid
complicated memory addressing.

Dimensioned arrays were stored in consecutive memory.  DIM X(10,10)
reserved 121 spaces (0-based indexing was the default).  In order to access
X(5,7), you would take the base address of X and add 7*11+5 to get the
correct memory address.

This naturally expands when you increase dimensions.  For example, DIM
Y(10,10,10) for item Y(3,5,4) would calculate (4*11+5)*11+3 as the offset.
Extending this to more dimensions is left as an exercise for the reader :->

(I knew there was a reason they made us learn assembly language...)

--Tom Pellitieri
  Century Equipment
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to