Re: Fat references

glen herrmannsfeldt <>
Wed, 30 Dec 2009 19:13:31 +0000 (UTC)

          From comp.compilers

Related articles
Fat references (Jon Harrop) (2009-12-29)
Re: Fat references (Paul Biggar) (2009-12-30)
Re: Fat references (Robert A Duff) (2009-12-30)
Re: Fat references (BGB / cr88192) (2009-12-30)
Re: Fat references (glen herrmannsfeldt) (2009-12-30)
Re: Fat references (Jon Harrop) (2009-12-30)
Re: Fat references (Kaz Kylheku) (2009-12-30)
Re: Fat references (Jon Harrop) (2009-12-30)
Re: Fat references (glen herrmannsfeldt) (2009-12-31)
Re: Fat references (Jon Harrop) (2010-01-01)
Re: Fat references (BGB / cr88192) (2010-01-01)
[24 later articles]
| List of all articles for this month |

From: glen herrmannsfeldt <>
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 <> wrote:

> 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

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.