Arnold gets it right on the Pascal indexing.
In UCSD Pascal you could specify any array bounds you would like and
the compiler would 0 base them for you by always doing a subtraction,
or addition if your min was negative, of your min array index. So a little
run time cost for non-zero based arrays.
I’m not sure how other Pascal compilers did this.
I find it interesting that there are now a slew of testing programs
(Valgrind, Address Sanitizer, Purify, etc) that will add the ‘missing’
array bounds checking for C.
David
On Jun 7, 2017, at 10:01 AM,
tuhs-request(a)minnie.tuhs.org wrote:
Date: Wed, 07 Jun 2017 07:20:43 -0600
From: arnold(a)skeeve.com
To: tuhs(a)tuhs.org, ag4ve.us(a)gmail.com
Subject: Re: [TUHS] Array index history
Message-ID: <201706071320.v57DKhmJ026303(a)freefriends.org>
Content-Type: text/plain; charset=us-ascii
Pascal (IIRC) allowed you to specify upper and lower bounds, something
like
foo : array[5..10] of integer;
with runtime bounds checking on array accesses. (I could be wrong ---
it's been a LLLLOOONNNGGG time.)
HTH,
Arnold