Re: Fat references

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Wed, 30 Dec 2009 19:13:31 +0000 (UTC)

          From comp.compilers

Related articles
Fat references jon@ffconsultancy.com (Jon Harrop) (2009-12-29)
Re: Fat references paul.biggar@gmail.com (Paul Biggar) (2009-12-30)
Re: Fat references bobduff@shell01.TheWorld.com (Robert A Duff) (2009-12-30)
Re: Fat references cr88192@hotmail.com (BGB / cr88192) (2009-12-30)
Re: Fat references gah@ugcs.caltech.edu (glen herrmannsfeldt) (2009-12-30)
Re: Fat references jon@ffconsultancy.com (Jon Harrop) (2009-12-30)
Re: Fat references kkylheku@gmail.com (Kaz Kylheku) (2009-12-30)
Re: Fat references jon@ffconsultancy.com (Jon Harrop) (2009-12-30)
Re: Fat references gah@ugcs.caltech.edu (glen herrmannsfeldt) (2009-12-31)
Re: Fat references jon@ffconsultancy.com (Jon Harrop) (2010-01-01)
Re: Fat references cr88192@hotmail.com (BGB / cr88192) (2010-01-01)
[24 later articles]
| List of all articles for this month |
From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Wed, 30 Dec 2009 19:13:31 +0000 (UTC)
Organization: California Institute of Technology, Pasadena
References: 09-12-045 09-12-050
Keywords: storage, GC
Posted-Date: 30 Dec 2009 23:31:24 EST

Robert A Duff <bobduff@shell01.theworld.com> wrote:
(snip)


> One advantage is that it can use zero-origin indexing. That is, if
> the bounds of the array are 10..20, the data address points to the
> 0'th array component, even though that component doesn't exist. So
> indexing doesn't need to subtract off the lower bound.


The array descriptors used by PL/I (or at least PL/I (F)) pass the
virtual origin (address of element with all subscripts zero), along
with the upper and lower bounds and the appropriate multiplier to
address array elements.


It seems that they way Fortran (assumed shape) arrays work, the called
routine doesn't use the lower bound, but normally uses a lower bound
of 1 for each subscript. (The called routine can change the lower
bound that it uses.)


The VAX/VMS array descriptor includes both the virtual and actual
origin, allowing for either PL/I style or Fortran style array
addressing.


There was a discussion on comp.lang.fortran some time ago (maybe
last year) on the advantages of each. To me, it seems more consistent
to pass and use the lower bound in the called routine, but it does
complicate array manipulation subroutines.


This also applies to array expressions. For PL/I array expressions,
the upper and lower bound must agree, where in Fortran only the
extent (upper-lower+1) need agree.


Something for designers of new languages to consider.


-- glen



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.