[TUHS] Array index history
David
david at kdbarto.org
Fri Jun 9 04:20:24 AEST 2017
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 at minnie.tuhs.org wrote:
>
> Date: Wed, 07 Jun 2017 07:20:43 -0600
> From: arnold at skeeve.com
> To: tuhs at tuhs.org, ag4ve.us at gmail.com
> Subject: Re: [TUHS] Array index history
> Message-ID: <201706071320.v57DKhmJ026303 at 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
More information about the TUHS
mailing list