Re: User selectable lower array bound? [message #26163 is a reply to message #25981] |
Mon, 06 August 2001 20:26   |
bennetsc
Messages: 18 Registered: January 1998
|
Junior Member |
|
|
In article <3B6F037D.B17A6287@astro.cornell.edu>,
JD Smith <jdsmith@astro.cornell.edu> wrote:
> Paul van Delst wrote:
>>
>> "Pavel A. Romashkin" wrote:
>>>
>>> Craig Markwardt wrote:
>>>>
>>>> Well, as grumpy as I have been in the past about IDL
> wishes, this is
>>>> one thing I do not want to have in IDL now!
>>>
>>> I am with you Craig. Besides, for the purists of array
> indexing, I think
>>> it is unfair to dasignate a *lower* array bounds. We don't
> designate the
>>> *upper* one.
>>
>> In the context of initially declaring an array in IDL, sure you do:
>>
>> x = fltarr(10)
>>
>> declares the upper bound as 9. We also designate a lower
> bound: 0. The difference between
>> the two is that I can change the former.
>>
So how about if {flt,dbl,complex,int,lon,dcomplex,byt,str}arr
and make_array could accept both the form shown above and this form:
y = fltarr(-5:10)
which would declare the lower bound as -5 and the upper bound as 9,
giving a total of 16 elements, including the zero element? This
isn't quite as nice as PL/1's method because of the zero element,
but it would be usable and wouldn't break any existing code. Future
programs would have to take into consideration that
y = fltarr(-5:-1)
would have a lower bound of -5 and an upper bound of -1, giving
a total of only 5 elements due to the lack of a zero element. PL/1's
syntax avoided this problem by having the lower bound default to 1
if not coded, but I think I could live with it as long as I were
aware of it.
Scott Bennett, Comm. ASMELG, CFIAG
College of Oceanic and Atmospheric
Sciences
Oregon State University
Corvallis, Oregon 97331
************************************************************ **********
* Internet: sbennett at oce.orst.edu *
*----------------------------------------------------------- ---------*
* "Lay then the axe to the root, and teach governments humanity. *
* It is their sanguinary punishments which corrupt mankind." *
* -- _The_Rights_of_Man_ by Tom Paine (1791.) *
************************************************************ **********
|
|
|