comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » User selectable lower array bound?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: User selectable lower array bound? [message #26089 is a reply to message #25981] Fri, 03 August 2001 15:36 Go to previous messageGo to previous message
John-David T. Smith is currently offline  John-David T. Smith
Messages: 384
Registered: January 2000
Senior Member
Craig Markwardt wrote:

> Which brings a gripe of my own to mind. One tricky problem with
> accessing arrays is that accessing out of bounds elements is both
> legal and illegal, depending on whether the subscript index is a
> scalar or an array.
>
> a[ [-1] ] = 0 ;; Succeeds!
> a[ -1 ] = 0 ;; Fails!
>
> What is up with that? :-)

From the manual:

>>>> >>>>>>>>>>
Using Arrays as Subscripts:
<snip>

If an element of the subscript array is less than or equal to zero, the
first element of the subscripted variable is selected. If an element of
the subscript is greater than or equal to the last subscript in the
subscripted variable (N, above), the last element is selected.
<<<<<<<<<<<<<<

Probably a user complained about having to check the bounds of their
array of indices, and RSI added this feature without thinking about the
consistency ramifications... apparently a theme of theirs.

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL virtual reality (was 3D Object IDL )
Next Topic: problem getting values from cw_bgroup normal base

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:38:23 PDT 2025

Total time taken to generate the page: 0.00438 seconds